separate public/internal reveal.js apis
This commit is contained in:
parent
f3f91922db
commit
6ff28af1b3
2
dist/reveal.es5.js
vendored
2
dist/reveal.es5.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.es5.js.map
vendored
2
dist/reveal.es5.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js
vendored
2
dist/reveal.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js.map
vendored
2
dist/reveal.js.map
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<title>reveal.js - Multiple Instances</title>
|
<title>reveal.js - Multiple Presentations</title>
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
|
|
||||||
@ -37,6 +37,9 @@
|
|||||||
embedded: true,
|
embedded: true,
|
||||||
keyboard: false
|
keyboard: false
|
||||||
} );
|
} );
|
||||||
|
r1.on( 'slidechanged', () => {
|
||||||
|
console.log( 'Deck 1 slide changed' );
|
||||||
|
} );
|
||||||
r1.initialize();
|
r1.initialize();
|
||||||
|
|
||||||
let r2 = new Reveal( document.querySelector( '.deck2' ), {
|
let r2 = new Reveal( document.querySelector( '.deck2' ), {
|
||||||
@ -46,6 +49,9 @@
|
|||||||
r2.initialize().then( () => {
|
r2.initialize().then( () => {
|
||||||
r2.slide(1);
|
r2.slide(1);
|
||||||
} );
|
} );
|
||||||
|
r2.on( 'slidechanged', () => {
|
||||||
|
console.log( 'Deck 2 slide changed' );
|
||||||
|
} );
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
68
js/reveal.js
68
js/reveal.js
@ -488,8 +488,8 @@ export default function( revealElement, options ) {
|
|||||||
|
|
||||||
if( config.touch ) touch.bind();
|
if( config.touch ) touch.bind();
|
||||||
if( config.keyboard ) keyboard.bind();
|
if( config.keyboard ) keyboard.bind();
|
||||||
|
if( config.progress ) progress.bind();
|
||||||
controls.bind();
|
controls.bind();
|
||||||
progress.bind();
|
|
||||||
|
|
||||||
dom.pauseOverlay.addEventListener( 'click', resume, false );
|
dom.pauseOverlay.addEventListener( 'click', resume, false );
|
||||||
|
|
||||||
@ -2345,8 +2345,8 @@ export default function( revealElement, options ) {
|
|||||||
// ------------------------------- API --------------------------------//
|
// ------------------------------- API --------------------------------//
|
||||||
// --------------------------------------------------------------------//
|
// --------------------------------------------------------------------//
|
||||||
|
|
||||||
|
// The public reveal.js API
|
||||||
return extend( Reveal, {
|
const API = {
|
||||||
VERSION,
|
VERSION,
|
||||||
|
|
||||||
initialize,
|
initialize,
|
||||||
@ -2366,12 +2366,7 @@ export default function( revealElement, options ) {
|
|||||||
next: navigateNext,
|
next: navigateNext,
|
||||||
|
|
||||||
// Navigation aliases
|
// Navigation aliases
|
||||||
navigateLeft,
|
navigateLeft, navigateRight, navigateUp, navigateDown, navigatePrev, navigateNext,
|
||||||
navigateRight,
|
|
||||||
navigateUp,
|
|
||||||
navigateDown,
|
|
||||||
navigatePrev,
|
|
||||||
navigateNext,
|
|
||||||
|
|
||||||
// Fragment methods
|
// Fragment methods
|
||||||
navigateFragment: fragments.goto.bind( fragments ),
|
navigateFragment: fragments.goto.bind( fragments ),
|
||||||
@ -2423,6 +2418,9 @@ export default function( revealElement, options ) {
|
|||||||
isOverview: overview.isActive.bind( overview ),
|
isOverview: overview.isActive.bind( overview ),
|
||||||
isPrintingPDF: print.isPrintingPDF.bind( print ),
|
isPrintingPDF: print.isPrintingPDF.bind( print ),
|
||||||
|
|
||||||
|
// Checks if reveal.js has been loaded and is ready for use
|
||||||
|
isReady: () => ready,
|
||||||
|
|
||||||
// Slide preloading
|
// Slide preloading
|
||||||
loadSlide: slideContent.load.bind( slideContent ),
|
loadSlide: slideContent.load.bind( slideContent ),
|
||||||
unloadSlide: slideContent.unload.bind( slideContent ),
|
unloadSlide: slideContent.unload.bind( slideContent ),
|
||||||
@ -2436,43 +2434,50 @@ export default function( revealElement, options ) {
|
|||||||
getState,
|
getState,
|
||||||
setState,
|
setState,
|
||||||
|
|
||||||
// Presentation progress
|
|
||||||
getSlidePastCount,
|
|
||||||
|
|
||||||
// Presentation progress on range of 0-1
|
// Presentation progress on range of 0-1
|
||||||
getProgress,
|
getProgress,
|
||||||
|
|
||||||
// Returns the indices of the current, or specified, slide
|
// Returns the indices of the current, or specified, slide
|
||||||
getIndices,
|
getIndices,
|
||||||
|
|
||||||
// Returns an Array of all slides
|
|
||||||
getSlides,
|
|
||||||
|
|
||||||
// Returns an Array of key:value maps of the attributes of each
|
// Returns an Array of key:value maps of the attributes of each
|
||||||
// slide in the deck
|
// slide in the deck
|
||||||
getSlidesAttributes,
|
getSlidesAttributes,
|
||||||
|
|
||||||
|
// Returns the number of slides that we have passed
|
||||||
|
getSlidePastCount,
|
||||||
|
|
||||||
// Returns the total number of slides
|
// Returns the total number of slides
|
||||||
getTotalSlides,
|
getTotalSlides,
|
||||||
|
|
||||||
// Returns the slide element at the specified index
|
// Returns the slide element at the specified index
|
||||||
getSlide,
|
getSlide,
|
||||||
|
|
||||||
|
// Returns the previous slide element, may be null
|
||||||
|
getPreviousSlide: () => previousSlide,
|
||||||
|
|
||||||
|
// Returns the current slide element
|
||||||
|
getCurrentSlide: () => currentSlide,
|
||||||
|
|
||||||
// Returns the slide background element at the specified index
|
// Returns the slide background element at the specified index
|
||||||
getSlideBackground,
|
getSlideBackground,
|
||||||
|
|
||||||
// Returns the speaker notes string for a slide, or null
|
// Returns the speaker notes string for a slide, or null
|
||||||
getSlideNotes: notes.getSlideNotes.bind( notes ),
|
getSlideNotes: notes.getSlideNotes.bind( notes ),
|
||||||
|
|
||||||
|
// Returns an Array of all slides
|
||||||
|
getSlides,
|
||||||
|
|
||||||
// Returns an array with all horizontal/vertical slides in the deck
|
// Returns an array with all horizontal/vertical slides in the deck
|
||||||
getHorizontalSlides,
|
getHorizontalSlides,
|
||||||
getVerticalSlides,
|
getVerticalSlides,
|
||||||
|
|
||||||
// Checks if the presentation contains two or more
|
// Checks if the presentation contains two or more horizontal
|
||||||
// horizontal/vertical slides
|
// and vertical slides
|
||||||
hasHorizontalSlides,
|
hasHorizontalSlides,
|
||||||
hasVerticalSlides,
|
hasVerticalSlides,
|
||||||
|
|
||||||
|
// Checks if the deck has navigated on either axis at least once
|
||||||
hasNavigatedHorizontally: () => navigationHistory.hasNavigatedHorizontally,
|
hasNavigatedHorizontally: () => navigationHistory.hasNavigatedHorizontally,
|
||||||
hasNavigatedVertically: () => navigationHistory.hasNavigatedVertically,
|
hasNavigatedVertically: () => navigationHistory.hasNavigatedVertically,
|
||||||
|
|
||||||
@ -2486,20 +2491,8 @@ export default function( revealElement, options ) {
|
|||||||
// Registers a new shortcut to include in the help overlay
|
// Registers a new shortcut to include in the help overlay
|
||||||
registerKeyboardShortcut: keyboard.registerKeyboardShortcut.bind( keyboard ),
|
registerKeyboardShortcut: keyboard.registerKeyboardShortcut.bind( keyboard ),
|
||||||
|
|
||||||
// API for registering and retrieving plugins
|
|
||||||
registerPlugin: plugins.registerPlugin.bind( plugins ),
|
|
||||||
hasPlugin: plugins.hasPlugin.bind( plugins ),
|
|
||||||
getPlugin: plugins.getPlugin.bind( plugins ),
|
|
||||||
getPlugins: plugins.getRegisteredPlugins.bind( plugins ),
|
|
||||||
|
|
||||||
getComputedSlideSize,
|
getComputedSlideSize,
|
||||||
|
|
||||||
// Returns the previous slide element, may be null
|
|
||||||
getPreviousSlide: () => previousSlide,
|
|
||||||
|
|
||||||
// Returns the current slide element
|
|
||||||
getCurrentSlide: () => currentSlide,
|
|
||||||
|
|
||||||
// Returns the current scale of the presentation content
|
// Returns the current scale of the presentation content
|
||||||
getScale: () => scale,
|
getScale: () => scale,
|
||||||
|
|
||||||
@ -2514,17 +2507,23 @@ export default function( revealElement, options ) {
|
|||||||
getSlidesElement: () => dom.slides,
|
getSlidesElement: () => dom.slides,
|
||||||
getBackgroundsElement: () => backgrounds.element,
|
getBackgroundsElement: () => backgrounds.element,
|
||||||
|
|
||||||
// Checks if reveal.js has been loaded and is ready for use
|
// API for registering and retrieving plugins
|
||||||
isReady: () => ready,
|
registerPlugin: plugins.registerPlugin.bind( plugins ),
|
||||||
|
hasPlugin: plugins.hasPlugin.bind( plugins ),
|
||||||
|
getPlugin: plugins.getPlugin.bind( plugins ),
|
||||||
|
getPlugins: plugins.getRegisteredPlugins.bind( plugins )
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
// The following API methods are primarily intended for use
|
// Our internal API which controllers have access to
|
||||||
// by reveal.js controllers
|
extend( Reveal, {
|
||||||
|
...API,
|
||||||
|
|
||||||
// Methods for announcing content to screen readers
|
// Methods for announcing content to screen readers
|
||||||
announceStatus,
|
announceStatus,
|
||||||
getStatusText,
|
getStatusText,
|
||||||
|
|
||||||
|
// Controllers
|
||||||
print,
|
print,
|
||||||
progress,
|
progress,
|
||||||
controls,
|
controls,
|
||||||
@ -2541,7 +2540,8 @@ export default function( revealElement, options ) {
|
|||||||
transformSlides,
|
transformSlides,
|
||||||
cueAutoSlide,
|
cueAutoSlide,
|
||||||
cancelAutoSlide
|
cancelAutoSlide
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
return API;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user