add sync method

edit
Hakim El Hattab 2013-04-27 16:09:38 -04:00
parent a764c21cd1
commit ce66980367
2 changed files with 28 additions and 25 deletions

View File

@ -328,7 +328,8 @@ var Reveal = (function(){
} }
/** /**
* Applies the configuration settings from the config object. * Applies the configuration settings from the config
* object. May be called multiple times.
*/ */
function configure( options ) { function configure( options ) {
@ -396,28 +397,7 @@ var Reveal = (function(){
} }
} }
postConfigure(); sync();
}
/**
* Updates various parts of the presentatio after the
* configuration has changed.
*/
function postConfigure() {
// Subscribe to input
removeEventListeners();
addEventListeners();
// Force a layout to make sure the current config is accounted for
layout();
// Reflect the current autoSlide value
autoSlide = config.autoSlide;
// Start auto-sliding if it's enabled
cueAutoSlide();
} }
@ -1167,6 +1147,28 @@ var Reveal = (function(){
} }
/**
* Syncs the presentation with the current DOM. Useful
* when new slides or control elements are added or when
* the configuration has changed.
*/
function sync() {
// Subscribe to input
removeEventListeners();
addEventListeners();
// Force a layout to make sure the current config is accounted for
layout();
// Reflect the current autoSlide value
autoSlide = config.autoSlide;
// Start auto-sliding if it's enabled
cueAutoSlide();
}
/** /**
* Updates one dimension of slides by showing the slide * Updates one dimension of slides by showing the slide
* with the specified index. * with the specified index.
@ -1983,6 +1985,7 @@ var Reveal = (function(){
return { return {
initialize: initialize, initialize: initialize,
configure: configure, configure: configure,
sync: sync,
// Navigation methods // Navigation methods
slide: slide, slide: slide,

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long