UNPKG

2.69 kBJavaScriptView Raw
1/**
2 * @license
3 * Copyright 2017 Google Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23
24/* eslint no-unused-vars: [2, {"args": "none"}] */
25
26/**
27 * Adapter for MDC Icon Toggle. Provides an interface for managing
28 * - classes
29 * - dom
30 * - inner text
31 * - event handlers
32 * - event dispatch
33 *
34 * Additionally, provides type information for the adapter to the Closure
35 * compiler.
36 *
37 * Implement this adapter for your framework of choice to delegate updates to
38 * the component in your framework of choice. See architecture documentation
39 * for more details.
40 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
41 *
42 * @record
43 */
44
45class MDCIconToggleAdapter {
46 /** @param {string} className */
47 addClass(className) {}
48
49 /** @param {string} className */
50 removeClass(className) {}
51
52 /**
53 * @param {string} type
54 * @param {!EventListener} handler
55 */
56 registerInteractionHandler(type, handler) {}
57
58 /**
59 * @param {string} type
60 * @param {!EventListener} handler
61 */
62 deregisterInteractionHandler(type, handler) {}
63
64 /** @param {string} text */
65 setText(text) {}
66
67 /** @return {number} */
68 getTabIndex() {}
69
70 /** @param {number} tabIndex */
71 setTabIndex(tabIndex) {}
72
73 /**
74 * @param {string} name
75 * @return {string}
76 */
77 getAttr(name) {}
78
79 /**
80 * @param {string} name
81 * @param {string} value
82 */
83 setAttr(name, value) {}
84
85 /** @param {string} name */
86 rmAttr(name) {}
87
88 /** @param {!IconToggleEvent} evtData */
89 notifyChange(evtData) {}
90}
91
92/**
93 * @typedef {{
94 * isOn: boolean,
95 * }}
96 */
97let IconToggleEvent;
98
99export {MDCIconToggleAdapter, IconToggleEvent};