adjustments to reveal.js initialization flow
This commit is contained in:
parent
9336fc11ca
commit
ddbe06eb7e
24
demo.html
24
demo.html
|
@ -410,13 +410,6 @@ Reveal.addEventListener( 'customevent', function() {
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
// WIP support for multiple reveal.js instances
|
|
||||||
// window.a = new Reveal(document.querySelector( '.reveal' ), {controls: false});
|
|
||||||
// a.initialize();
|
|
||||||
// window.b = new Reveal(document.querySelector( '.reveal' ), {controls: true});
|
|
||||||
// b.initialize();
|
|
||||||
// console.log(a.getConfig().controls,b.getConfig().controls);
|
|
||||||
|
|
||||||
// More info https://github.com/hakimel/reveal.js#configuration
|
// More info https://github.com/hakimel/reveal.js#configuration
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
controls: true,
|
controls: true,
|
||||||
|
@ -439,5 +432,22 @@ Reveal.addEventListener( 'customevent', function() {
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<script type="module">
|
||||||
|
|
||||||
|
// WIP support for multiple reveal.js instances
|
||||||
|
import Reveal from '/js/reveal.js'
|
||||||
|
|
||||||
|
window.a = new Reveal(document.querySelector( '.reveal' ), {controls: false});
|
||||||
|
a.initialize();
|
||||||
|
|
||||||
|
window.b = new Reveal(document.querySelector( '.reveal' ), {controls: true});
|
||||||
|
b.initialize();
|
||||||
|
|
||||||
|
console.log(a.getConfig().controls,b.getConfig().controls);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
-->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
File diff suppressed because one or more lines are too long
27
js/index.js
27
js/index.js
|
@ -1,21 +1,16 @@
|
||||||
import Presentation from './reveal.js'
|
import Presentation from './reveal.js'
|
||||||
|
|
||||||
// The Reveal class can be instantiated to run multiple
|
// Provides a backwards compatible way to initialize
|
||||||
// presentations on the same page
|
// reveal.js when there is only one presentation on
|
||||||
//
|
// the page.
|
||||||
// let rvl = new Reveal( <HTMLElement>, { controls: false } )
|
|
||||||
// rvl.initialize()
|
|
||||||
// rvl.slide(2)
|
|
||||||
window.Reveal = Presentation;
|
|
||||||
|
|
||||||
// Simplified way to create a reveal.js instance on
|
|
||||||
// a page with only one presentation, makes us backwards
|
|
||||||
// compatible with reveal.js pre 4.0
|
|
||||||
//
|
//
|
||||||
// Reveal.initialize({ controls: false })
|
// Reveal.initialize({ controls: false })
|
||||||
// Revea.slide(2)
|
// Reveal.slide(2)
|
||||||
window.Reveal.initialize = options => {
|
window.Reveal = {
|
||||||
window.Reveal = new Presentation( document.querySelector( '.reveal' ), options );
|
|
||||||
window.Reveal.initialize();
|
initialize: options => {
|
||||||
return new Promise( resolve => window.Reveal.addEventListener( 'ready', resolve ) );
|
window.Reveal = new Presentation( document.querySelector( '.reveal' ), options );
|
||||||
|
return window.Reveal.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -153,7 +153,7 @@ export default function( revealElement, options ) {
|
||||||
// Load plugins then move on to #start()
|
// Load plugins then move on to #start()
|
||||||
plugins.load( config.dependencies ).then( start )
|
plugins.load( config.dependencies ).then( start )
|
||||||
|
|
||||||
return Reveal;
|
return new Promise( resolve => Reveal.addEventListener( 'ready', resolve ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue