-
Notifications
You must be signed in to change notification settings - Fork 165
/
Copy pathoff.stories.js
100 lines (88 loc) · 1.89 KB
/
off.stories.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { storiesOf } from '@storybook/html'
storiesOf('off()', module)
.add(
'open',
() => `
<img src="image-2.jpg">
<script>
const zoom = mediumZoom('img');
const onOpen = () => alert('open')
zoom.on('open', onOpen);
zoom.off('open', onOpen);
</script>
`,
{
notes: {
markdown: 'Listens and removes the listener on `open`.',
},
}
)
.add(
'opened',
() => `
<img src="image-2.jpg">
<script>
const zoom = mediumZoom('img');
const onOpened = () => alert('opened')
zoom.on('opened', onOpened);
zoom.off('opened', onOpened);
</script>
`,
{
notes: {
markdown: 'Listens and removes the listener on `opened`.',
},
}
)
.add(
'close',
() => `
<img src="image-2.jpg">
<script>
const zoom = mediumZoom('img');
const onClose = () => alert('close')
zoom.on('close', onClose);
zoom.off('close', onClose);
</script>
`,
{
notes: {
markdown: 'Listens and removes the listener on `close`.',
},
}
)
.add(
'closed',
() => `
<img src="image-2.jpg">
<script>
const zoom = mediumZoom('img');
const onClosed = () => alert('closed')
zoom.on('closed', onClosed);
zoom.off('closed', onClosed);
</script>
`,
{
notes: {
markdown: 'Listens and removes the listener on `closed`.',
},
}
)
.add(
'detach',
() => `
<img src="image-2.jpg">
<script>
const zoom = mediumZoom('img');
const onDetach = () => alert('detach')
zoom.on('detach', onDetach);
zoom.off('detach', onDetach);
zoom.detach();
</script>
`,
{
notes: {
markdown: 'Listens and removes the listener on `detach`.',
},
}
)