add isReady method to check reveal.js loaded state
This commit is contained in:
		
							
								
								
									
										10
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -96,6 +96,9 @@ var Reveal = (function(){ | |||||||
| 			dependencies: [] | 			dependencies: [] | ||||||
| 		}, | 		}, | ||||||
|  |  | ||||||
|  | 		// Flags if reveal.js is loaded (has dispatched the 'ready' event) | ||||||
|  | 		loaded = false, | ||||||
|  |  | ||||||
| 		// The current auto-slide duration | 		// The current auto-slide duration | ||||||
| 		autoSlide = 0, | 		autoSlide = 0, | ||||||
|  |  | ||||||
| @@ -447,6 +450,8 @@ var Reveal = (function(){ | |||||||
| 			// Enable transitions now that we're loaded | 			// Enable transitions now that we're loaded | ||||||
| 			dom.slides.classList.remove( 'no-transition' ); | 			dom.slides.classList.remove( 'no-transition' ); | ||||||
|  |  | ||||||
|  | 			loaded = true; | ||||||
|  |  | ||||||
| 			dispatchEvent( 'ready', { | 			dispatchEvent( 'ready', { | ||||||
| 				'indexh': indexh, | 				'indexh': indexh, | ||||||
| 				'indexv': indexv, | 				'indexv': indexv, | ||||||
| @@ -2670,6 +2675,11 @@ var Reveal = (function(){ | |||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
|  |  | ||||||
|  | 		// Checks if reveal.js has been loaded and is ready for use | ||||||
|  | 		isReady: function() { | ||||||
|  | 			return loaded; | ||||||
|  | 		}, | ||||||
|  |  | ||||||
| 		// Forward event binding to the reveal DOM element | 		// Forward event binding to the reveal DOM element | ||||||
| 		addEventListener: function( type, listener, useCapture ) { | 		addEventListener: function( type, listener, useCapture ) { | ||||||
| 			if( 'addEventListener' in window ) { | 			if( 'addEventListener' in window ) { | ||||||
|   | |||||||
							
								
								
									
										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