add sync method
This commit is contained in:
		
							
								
								
									
										49
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -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
									
									
								
							
							
						
						
									
										4
									
								
								js/reveal.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user