Mercurial > hg > Papers > 2021 > ikkun-master
comparison poster/s62/slides.state.js @ 3:1b34d9710a84
add poster
author | ikkun <ikkun@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 15 Feb 2021 10:51:57 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:68a602b80b3f | 3:1b34d9710a84 |
---|---|
1 | |
2 | |
3 class S6_Plugin_State { | |
4 | |
5 constructor( deck, options ) { | |
6 | |
7 console.log( "[S6.Plugin.State] ctor"); | |
8 | |
9 const updateState = (method, ev) => { | |
10 console.log( "[S6.Plugin.State] updateState method="+method ); | |
11 | |
12 const attr = ev.slide.getAttribute( 'data-bespoke-state' ); | |
13 | |
14 if( attr ) | |
15 attr.split(' ').forEach( state => deck.parent.classList[method](state) ); | |
16 }; | |
17 | |
18 deck.on( 'activate', ev => updateState( 'add', ev )); | |
19 deck.on( 'deactivate', ev => updateState( 'remove', ev )); | |
20 } | |
21 } // class S6_Plugin_State | |
22 | |
23 | |
24 | |
25 ////////////////////////////// | |
26 // add global S6 "export" | |
27 // e.g. lets you call state( options ) for plugins array config | |
28 | |
29 var S6 = S6 || {}; | |
30 S6.state = options => deck => new S6_Plugin_State( deck, options ); |