Debian Codegraph @

types-autosize/index.d.ts

raw
1 // Type definitions for autosize 4.0
2 // Project: http://www.jacklmoore.com/autosize/
3 // Definitions by: Aaron T. King <https://github.com/kingdango>
4 // keika299 <https://github.com/keika299>
5 // NeekSandhu <https://github.com/NeekSandhu>
6 // BendingBender <https://github.com/BendingBender>
7 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8 // TypeScript Version: 2.3
9
10 export = autosize;
11 export as namespace autosize;
12
13 /**
14 * Attach Autosize to NodeList/Element/JQuery.
15 *
16 * @example
17 * import autosize = require('autosize');
18 *
19 * // from a NodeList
20 * autosize(document.querySelectorAll('textarea'));
21 *
22 * // from a single Node
23 * autosize(document.querySelector('textarea'));
24 *
25 * // from a jQuery collection
26 * autosize($('textarea'));
27 */
28 declare function autosize<T extends ArrayLike<Element> | Element>(elements: T): T;
29
30 declare namespace autosize {
31 /**
32 * Triggers the height adjustment for an assigned textarea element.
33 * Autosize will automatically adjust the textarea height on keyboard and window resize events.
34 * There is no efficient way for Autosize to monitor for when another script has changed the textarea value or for changes in layout that impact the textarea element.
35 */
36 function update<T extends ArrayLike<Element> | Element>(elements: T): T;
37
38 /**
39 * Removes Autosize and reverts any changes it made to the textarea element.
40 */
41 function destroy<T extends ArrayLike<Element> | Element>(elements: T): T;
42 }