plugin docs

This commit is contained in:
Hakim El Hattab 2019-04-01 15:25:40 +02:00 committed by GitHub
parent 25c504c22f
commit 485870946f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -1212,11 +1212,9 @@ Plugins should be registered with reveal.js by calling `Reveal.registerPlugin( '
When reveal.js is booted up via `Reveal.initialize()`, it will go through all registered plugins and invoke their "init" methods. If the "init" method returns a Promise, reveal.js will wait for that promise to be fullfilled before finshing the startup sequence and firing the [ready](#ready-event) event. Here's an example of a plugin that returns a promise: When reveal.js is booted up via `Reveal.initialize()`, it will go through all registered plugins and invoke their "init" methods. If the "init" method returns a Promise, reveal.js will wait for that promise to be fullfilled before finshing the startup sequence and firing the [ready](#ready-event) event. Here's an example of a plugin that returns a promise:
``` ```javascript
Reveal.registerPlugin( 'myPlugin', { Reveal.registerPlugin( 'myPlugin', {
init: () => { init: () => new Promise( resolve => setTimeout( resolve, 3000 ) )
return new Promise( resolve => setTimeout( resolve, 3000 ) );
}
} ); } );
Reveal.addEventListener( 'ready', () => console.log( 'Three seconds later...' ) ); Reveal.addEventListener( 'ready', () => console.log( 'Three seconds later...' ) );
Reveal.initialize(); Reveal.initialize();