|
21 | 21 | * THE SOFTWARE.
|
22 | 22 | */
|
23 | 23 |
|
24 |
| -/* eslint no-unused-vars: [2, {"args": "none"}] */ |
| 24 | +import {EventType, SpecificEventListener} from '@material/base/types'; |
25 | 25 |
|
26 | 26 | /**
|
27 |
| - * Adapter for MDC Top App Bar |
28 |
| - * |
29 |
| - * Defines the shape of the adapter expected by the foundation. Implement this |
30 |
| - * adapter to integrate the Top App Bar into your framework. See |
31 |
| - * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md |
32 |
| - * for more information. |
33 |
| - * |
34 |
| - * @record |
| 27 | + * Defines the shape of the adapter expected by the foundation. |
| 28 | + * Implement this adapter for your framework of choice to delegate updates to |
| 29 | + * the component in your framework of choice. See architecture documentation |
| 30 | + * for more details. |
| 31 | + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md |
35 | 32 | */
|
36 |
| -class MDCTopAppBarAdapter { |
| 33 | +interface MDCTopAppBarAdapter { |
37 | 34 | /**
|
38 | 35 | * Adds a class to the root Element.
|
39 |
| - * @param {string} className |
40 | 36 | */
|
41 |
| - addClass(className) {} |
| 37 | + addClass(className: string): void; |
42 | 38 |
|
43 | 39 | /**
|
44 | 40 | * Removes a class from the root Element.
|
45 |
| - * @param {string} className |
46 | 41 | */
|
47 |
| - removeClass(className) {} |
| 42 | + removeClass(className: string): void; |
48 | 43 |
|
49 | 44 | /**
|
50 | 45 | * Returns true if the root Element contains the given class.
|
51 |
| - * @param {string} className |
52 |
| - * @return {boolean} |
53 | 46 | */
|
54 |
| - hasClass(className) {} |
| 47 | + hasClass(className: string): boolean; |
55 | 48 |
|
56 | 49 | /**
|
57 | 50 | * Sets the specified inline style property on the root Element to the given value.
|
58 |
| - * @param {string} property |
59 |
| - * @param {string} value |
60 | 51 | */
|
61 |
| - setStyle(property, value) {} |
| 52 | + setStyle(property: string, value: string): void; |
62 | 53 |
|
63 | 54 | /**
|
64 | 55 | * Gets the height of the top app bar.
|
65 |
| - * @return {number} |
66 | 56 | */
|
67 |
| - getTopAppBarHeight() {} |
| 57 | + getTopAppBarHeight(): number; |
68 | 58 |
|
69 | 59 | /**
|
70 | 60 | * Registers an event handler on the navigation icon element for a given event.
|
71 |
| - * @param {string} type |
72 |
| - * @param {function(!Event): undefined} handler |
73 | 61 | */
|
74 |
| - registerNavigationIconInteractionHandler(type, handler) {} |
| 62 | + registerNavigationIconInteractionHandler<K extends EventType>(type: K, handler: SpecificEventListener<K>): void; |
75 | 63 |
|
76 | 64 | /**
|
77 | 65 | * Deregisters an event handler on the navigation icon element for a given event.
|
78 |
| - * @param {string} type |
79 |
| - * @param {function(!Event): undefined} handler |
80 | 66 | */
|
81 |
| - deregisterNavigationIconInteractionHandler(type, handler) {} |
| 67 | + deregisterNavigationIconInteractionHandler<K extends EventType>(type: K, handler: SpecificEventListener<K>): void; |
82 | 68 |
|
83 | 69 | /**
|
84 | 70 | * Emits an event when the navigation icon is clicked.
|
85 | 71 | */
|
86 |
| - notifyNavigationIconClicked() {} |
| 72 | + notifyNavigationIconClicked(): void; |
87 | 73 |
|
88 |
| - /** @param {function(!Event)} handler */ |
89 |
| - registerScrollHandler(handler) {} |
| 74 | + registerScrollHandler(handler: SpecificEventListener<'scroll'>): void; |
90 | 75 |
|
91 |
| - /** @param {function(!Event)} handler */ |
92 |
| - deregisterScrollHandler(handler) {} |
| 76 | + deregisterScrollHandler(handler: SpecificEventListener<'scroll'>): void; |
93 | 77 |
|
94 |
| - /** @param {function(!Event)} handler */ |
95 |
| - registerResizeHandler(handler) {} |
| 78 | + registerResizeHandler(handler: SpecificEventListener<'resize'>): void; |
96 | 79 |
|
97 |
| - /** @param {function(!Event)} handler */ |
98 |
| - deregisterResizeHandler(handler) {} |
| 80 | + deregisterResizeHandler(handler: SpecificEventListener<'resize'>): void; |
99 | 81 |
|
100 |
| - /** @return {number} */ |
101 |
| - getViewportScrollY() {} |
| 82 | + getViewportScrollY(): number; |
102 | 83 |
|
103 |
| - /** @return {number} */ |
104 |
| - getTotalActionItems() {} |
| 84 | + getTotalActionItems(): number; |
105 | 85 | }
|
106 | 86 |
|
107 |
| -export default MDCTopAppBarAdapter; |
| 87 | +export {MDCTopAppBarAdapter as default, MDCTopAppBarAdapter}; |
0 commit comments