use object shorthand for api

This commit is contained in:
Hakim El Hattab 2020-03-06 17:50:15 +01:00
parent a6b7cc4eca
commit 32bbe63ea6
1 changed files with 58 additions and 58 deletions

View File

@ -5306,7 +5306,7 @@
* @return {boolean} true if there was a previous fragment, * @return {boolean} true if there was a previous fragment,
* false otherwise * false otherwise
*/ */
function previousFragment() { function prevFragment() {
return navigateFragment( null, -1 ); return navigateFragment( null, -1 );
@ -5436,7 +5436,7 @@
} }
} }
// Normal navigation // Normal navigation
else if( ( isOverview() || previousFragment() === false ) && availableRoutes().left ) { else if( ( isOverview() || prevFragment() === false ) && availableRoutes().left ) {
slide( indexh - 1, config.navigationMode === 'grid' ? indexv : undefined ); slide( indexh - 1, config.navigationMode === 'grid' ? indexv : undefined );
} }
@ -5448,7 +5448,7 @@
// Reverse for RTL // Reverse for RTL
if( config.rtl ) { if( config.rtl ) {
if( ( isOverview() || previousFragment() === false ) && availableRoutes().right ) { if( ( isOverview() || prevFragment() === false ) && availableRoutes().right ) {
slide( indexh - 1, config.navigationMode === 'grid' ? indexv : undefined ); slide( indexh - 1, config.navigationMode === 'grid' ? indexv : undefined );
} }
} }
@ -5462,7 +5462,7 @@
function navigateUp() { function navigateUp() {
// Prioritize hiding fragments // Prioritize hiding fragments
if( ( isOverview() || previousFragment() === false ) && availableRoutes().up ) { if( ( isOverview() || prevFragment() === false ) && availableRoutes().up ) {
slide( indexh, indexv - 1 ); slide( indexh, indexv - 1 );
} }
@ -5488,7 +5488,7 @@
function navigatePrev() { function navigatePrev() {
// Prioritize revealing fragments // Prioritize revealing fragments
if( previousFragment() === false ) { if( prevFragment() === false ) {
if( availableRoutes().up ) { if( availableRoutes().up ) {
navigateUp(); navigateUp();
} }
@ -6357,15 +6357,15 @@
Reveal = { Reveal = {
VERSION: VERSION, VERSION: VERSION,
initialize: initialize, initialize,
configure: configure, configure,
sync: sync, sync,
syncSlide: syncSlide, syncSlide,
syncFragments: syncFragments, syncFragments,
// Navigation methods // Navigation methods
slide: slide, slide,
left: navigateLeft, left: navigateLeft,
right: navigateRight, right: navigateRight,
up: navigateUp, up: navigateUp,
@ -6373,11 +6373,6 @@
prev: navigatePrev, prev: navigatePrev,
next: navigateNext, next: navigateNext,
// Fragment methods
navigateFragment: navigateFragment,
prevFragment: previousFragment,
nextFragment: nextFragment,
// Deprecated aliases // Deprecated aliases
navigateTo: slide, navigateTo: slide,
navigateLeft: navigateLeft, navigateLeft: navigateLeft,
@ -6387,84 +6382,100 @@
navigatePrev: navigatePrev, navigatePrev: navigatePrev,
navigateNext: navigateNext, navigateNext: navigateNext,
// Fragment methods
navigateFragment,
prevFragment,
nextFragment,
// Forces an update in slide layout // Forces an update in slide layout
layout: layout, layout,
// Randomizes the order of slides // Randomizes the order of slides
shuffle: shuffle, shuffle,
// Returns an object with the available routes as booleans (left/right/top/bottom) // Returns an object with the available routes as booleans (left/right/top/bottom)
availableRoutes: availableRoutes, availableRoutes,
// Returns an object with the available fragments as booleans (prev/next) // Returns an object with the available fragments as booleans (prev/next)
availableFragments: availableFragments, availableFragments,
// Toggles a help overlay with keyboard shortcuts // Toggles a help overlay with keyboard shortcuts
toggleHelp: toggleHelp, toggleHelp,
// Toggles the overview mode on/off // Toggles the overview mode on/off
toggleOverview: toggleOverview, toggleOverview,
// Toggles the "black screen" mode on/off // Toggles the "black screen" mode on/off
togglePause: togglePause, togglePause,
// Toggles the auto slide mode on/off // Toggles the auto slide mode on/off
toggleAutoSlide: toggleAutoSlide, toggleAutoSlide,
// State checks // State checks
isOverview: isOverview, isOverview,
isPaused: isPaused, isPaused,
isAutoSliding: isAutoSliding, isAutoSliding,
isSpeakerNotes: isSpeakerNotes, isSpeakerNotes,
// Slide preloading // Slide preloading
loadSlide: loadSlide, loadSlide,
unloadSlide: unloadSlide, unloadSlide,
// Adds or removes all internal event listeners (such as keyboard) // Adds or removes all internal event listeners (such as keyboard)
addEventListeners: addEventListeners, addEventListeners,
removeEventListeners: removeEventListeners, removeEventListeners,
// Facility for persisting and restoring the presentation state // Facility for persisting and restoring the presentation state
getState: getState, getState,
setState: setState, setState,
// Presentation progress // Presentation progress
getSlidePastCount: getSlidePastCount, getSlidePastCount,
// Presentation progress on range of 0-1 // Presentation progress on range of 0-1
getProgress: getProgress, getProgress,
// Returns the indices of the current, or specified, slide // Returns the indices of the current, or specified, slide
getIndices: getIndices, getIndices,
// Returns an Array of all slides // Returns an Array of all slides
getSlides: getSlides, getSlides,
// Returns an Array of objects representing the attributes on // Returns an Array of objects representing the attributes on
// the slides // the slides
getSlidesAttributes: getSlidesAttributes, getSlidesAttributes,
// Returns the total number of slides // Returns the total number of slides
getTotalSlides: getTotalSlides, getTotalSlides,
// Returns the slide element at the specified index // Returns the slide element at the specified index
getSlide: getSlide, getSlide,
// Returns the slide background element at the specified index // Returns the slide background element at the specified index
getSlideBackground: getSlideBackground, getSlideBackground,
// Returns the speaker notes string for a slide, or null // Returns the speaker notes string for a slide, or null
getSlideNotes: getSlideNotes, getSlideNotes,
// Returns an array with all horizontal/vertical slides in the deck // Returns an array with all horizontal/vertical slides in the deck
getHorizontalSlides: getHorizontalSlides, getHorizontalSlides,
getVerticalSlides: getVerticalSlides, getVerticalSlides,
// Checks if the presentation contains two or more // Checks if the presentation contains two or more
// horizontal/vertical slides // horizontal/vertical slides
hasHorizontalSlides: hasHorizontalSlides, hasHorizontalSlides,
hasVerticalSlides: hasVerticalSlides, hasVerticalSlides,
// Adds/removes a custom key binding
addKeyBinding,
removeKeyBinding,
// API for registering and retrieving plugins
registerPlugin,
hasPlugin,
getPlugin,
getComputedSlideSize,
// Returns the previous slide element, may be null // Returns the previous slide element, may be null
getPreviousSlide: () => { getPreviousSlide: () => {
@ -6481,8 +6492,6 @@
return scale; return scale;
}, },
getComputedSlideSize: getComputedSlideSize,
// Returns the current configuration object // Returns the current configuration object
getConfig: () => { getConfig: () => {
return config; return config;
@ -6566,15 +6575,6 @@
} }
}, },
// Adds/removes a custom key binding
addKeyBinding: addKeyBinding,
removeKeyBinding: removeKeyBinding,
// API for registering and retrieving plugins
registerPlugin: registerPlugin,
hasPlugin: hasPlugin,
getPlugin: getPlugin,
// Programmatically triggers a keyboard event // Programmatically triggers a keyboard event
triggerKey: keyCode => { triggerKey: keyCode => {
onDocumentKeyDown( { keyCode } ); onDocumentKeyDown( { keyCode } );