Skip to content
Snippets Groups Projects
Select Git revision
  • fd49131b748706b9aa2328ceb05a33310f1be60b
  • main default protected
  • jw_sonar
  • v6.0.0 protected
  • bedran_exercise-list
  • ask-user-to-delete-exercises-on-duplicates
  • update-dependencies
  • jw_sonar_backup
  • add_route_assignments
  • 6.0.0-dev
  • 5.0.1
  • 5.0.0
  • 4.1.0
  • 4.0.0
  • 3.5.3
  • 3.5.2
  • 3.5.1
  • 3.5.0
  • 3.4.2
  • 3.4.1
  • 3.4.0
  • 3.3.0
  • 3.2.0
  • 3.1.3
  • 3.1.2
  • 3.1.1
  • 3.1.0
  • 3.0.1
  • 3.0.0
29 results

BaseRoutes.ts

Blame
  • index.js 1.45 KiB
    import Deck, { VERSION } from './reveal.js'
    
    /**
     * Expose the Reveal class to the window. To create a
     * new instance:
     * let deck = new Reveal( document.querySelector( '.reveal' ), {
     *   controls: false
     * } );
     * deck.initialize().then(() => {
     *   // reveal.js is ready
     * });
     */
    let Reveal = Deck;
    
    
    /**
     * The below is a thin shell that mimics the pre 4.0
     * reveal.js API and ensures backwards compatibility.
     * This API only allows for one Reveal instance per
     * page, whereas the new API above lets you run many
     * presentations on the same page.
     *
     * Reveal.initialize( { controls: false } ).then(() => {
     *   // reveal.js is ready
     * });
     */
    
    let enqueuedAPICalls = [];
    
    Reveal.initialize = options => {
    
    	// Create our singleton reveal.js instance
    	Object.assign( Reveal, new Deck( document.querySelector( '.reveal' ), options ) );
    
    	// Invoke any enqueued API calls
    	enqueuedAPICalls.map( method => method( Reveal ) );
    
    	return Reveal.initialize();
    
    }
    
    /**
     * The pre 4.0 API let you add event listener before
     * initializing. We maintain the same behavior by
     * queuing up premature API calls and invoking all
     * of them when Reveal.initialize is called.
     */
    [ 'configure', 'on', 'off', 'addEventListener', 'removeEventListener', 'registerPlugin' ].forEach( method => {
    	Reveal[method] = ( ...args ) => {
    		enqueuedAPICalls.push( deck => deck[method].call( null, ...args ) );
    	}
    } );
    
    Reveal.isReady = () => false;
    
    Reveal.VERSION = VERSION;
    
    export default Reveal;