jackmoore/autosize

How to know that it was initialized

aloky opened this issue · 1 comments

aloky commented

autosize(el).isInit // true

I don't have a way of detecting that from outside of the autosize function. However, assigning autosize is synchronous, so you'll know it has initialized as soon as you assign it. For example:

autosize(el);
var isInit = true;

It's fine to re-assign autosize, it will do nothing if it detects that autosize is already applied.

autosize(el);
autosize(el); // this is fine

Same thing with calling destroy:

var el1 = document.querySelector('textarea')[0];
var el2 = document.querySelector('textarea')[1];
autosize(e1);
autosize.destroy(el1);
autosize.destroy(el1); // fine
autosize.destroy(el2); // also fine

Sorry, I know this isn't what you are looking for, it's just all I have at the moment.