Skip to content

Commit 3a2036e

Browse files
committed
add 'ready' event (#182)
1 parent f70dcd3 commit 3a2036e

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ Reveal.addEventListener( 'somestate', function() {
154154
}, false );
155155
```
156156

157+
### Ready event
158+
159+
The 'ready' event is fired when reveal.js has loaded all (synchronous) dependencies and is ready to start navigating.
160+
161+
```javascript
162+
Reveal.addEventListener( 'ready', function( event ) {
163+
// event.currentSlide, event.indexh, event.indexv
164+
} );
165+
```
166+
157167
### Slide change event
158168

159169
An 'slidechanged' event is fired each time the slide is changed (regardless of state). The event object holds the index values of the current slide as well as a reference to the previous and current slide HTML nodes.

js/reveal.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* reveal.js 2.1 r33
2+
* reveal.js 2.1 r34
33
* http://lab.hakim.se/reveal-js
44
* MIT licensed
55
*
@@ -267,6 +267,13 @@ var Reveal = (function(){
267267

268268
// Start auto-sliding if it's enabled
269269
cueAutoSlide();
270+
271+
// Notify listeners that the presentation is ready
272+
dispatchEvent( 'ready', {
273+
'indexh': indexh,
274+
'indexv': indexv,
275+
'currentSlide': currentSlide
276+
} );
270277
}
271278

272279
/**

js/reveal.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)