reveal: Add more tests and definitions

This commit is contained in:
Kevin Brightwell 2017-01-02 13:08:17 -05:00
parent 41d00df110
commit 43bf719857
2 changed files with 133 additions and 14 deletions

43
reveal/index.d.ts vendored
View File

@ -30,19 +30,19 @@ interface RevealStatic {
// Retrieves the previous and current slide elements
getPreviousSlide():Element;
getCurrentSlide():Element;
getPreviousSlide(): Element;
getCurrentSlide(): Element;
getIndices(slide?:Element):{h:number; v:number;};
getProgress():number;
getTotalSlides():number;
// Returns the speaker notes for the current slide
getSlideNotes(slide:any):string;
getSlideNotes(slide?:Element):string;
// States
addEventListener(type:string, listener:Function, useCapture?:boolean):void;
removeEventListener(type:string, listener:Function, useCapture?:boolean):void;
addEventListener(type:string, listener:(event: any)=>void, useCapture?:boolean):void;
removeEventListener(type:string, listener:(event: any)=>void, useCapture?:boolean):void;
// State Checks
isFirstSlide():boolean;
@ -97,10 +97,19 @@ interface RevealOptions {
transitionSpeed?:string;
backgroundTransition?:string;
viewDistance?:number;
parallaxBackgroundImage?:string;
parallaxBackgroundSize?:string;
parallaxBackgroundHorizontal?:any;
parallaxBackgroundVertical?:any;
// https://github.com/hakimel/reveal.js/#parallax-background
// Parallax background image
parallaxBackgroundImage?: string;
// Parallax background size
parallaxBackgroundSize?: string; // CSS syntax, e.g. "2100px 900px" - currently only pixels are supported (don't use % or auto)
// Number of pixels to move the parallax background per slide
// - Calculated automatically unless specified
// - Set to 0 to disable movement along an axis
parallaxBackgroundHorizontal?: number;
parallaxBackgroundVertical?: number;
rollingLinks?:boolean;
theme?:string;
@ -130,6 +139,19 @@ interface RevealOptions {
math?: MathConfig;
}
// https://github.com/hakimel/reveal.js/#slide-changed-event
interface SlideEvent {
previousSlide?: Element;
currentSlide: Element;
indexh: number;
indexv?: number;
}
// https://github.com/hakimel/reveal.js/#fragment-events
interface FragmentEvent {
fragment: Element;
}
// https://github.com/hakimel/reveal.js/#multiplexing
interface MultiplexConfig {
// Obtained from the socket.io server. Gives this (the master) control of the presentation
@ -147,9 +169,6 @@ interface MathConfig {
mathjax: string;
// Obtained from the socket.io server
config: string;
// Location of socket.io server
url: string;
}
// https://github.com/hakimel/reveal.js/#dependencies

View File

@ -5,5 +5,105 @@ Reveal.initialize({
progress: true,
history: true,
center: true,
transition: 'linear'
});
transition: 'linear',
slideNumber: 'c/t',
width: '100%',
height: '80%',
postMessage: true,
postMessageEvents: true,
multiplex: {
// Example values. To generate your own, see the socket.io server instructions.
secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
id: '1ea875674b17ca76', // Obtained from socket.io server
url: 'https://reveal-js-multiplex-ccjbegmaii.now.sh' // Location of socket.io server
},
math: {
mathjax: 'https://cdn.mathjax.org/mathjax/latest/MathJax.js',
config: 'TeX-AMS_HTML-full' // See http://docs.mathjax.org/en/latest/config-files.html
},
dependencies: [
{ src: 'plugin/multiplex/master.js', async: true },
{ src: 'plugin/math/math.js', async: true }
]
});
// Alternate representations
Reveal.initialize({
slideNumber: true,
width: 20,
height: 20
});
// Taken from https://github.com/hakimel/reveal.js/#api
// Navigation
Reveal.slide( 0, 1, 2 );
Reveal.left();
Reveal.right();
Reveal.up();
Reveal.down();
Reveal.prev();
Reveal.next();
Reveal.prevFragment();
Reveal.nextFragment();
// Randomize the order of slides
Reveal.shuffle();
// Toggle presentation states, optionally pass true/false to force on/off
Reveal.toggleOverview();
Reveal.togglePause();
Reveal.toggleAutoSlide();
// Change a config value at runtime
Reveal.configure({ controls: true });
// Returns the present configuration options
Reveal.getConfig();
// Fetch the current scale of the presentation
Reveal.getScale();
// Retrieves the previous and current slide elements
Reveal.getPreviousSlide();
Reveal.getCurrentSlide();
Reveal.getIndices(); // { h: 0, v: 0 } }
Reveal.getProgress(); // 0-1
Reveal.getTotalSlides();
// Returns the speaker notes for the current slide
Reveal.getSlideNotes();
// State checks
Reveal.isFirstSlide();
Reveal.isLastSlide();
Reveal.isOverview();
Reveal.isPaused();
Reveal.isAutoSliding();
Reveal.addEventListener( 'slidechanged', ( event: SlideEvent ) => {
// event.previousSlide, event.currentSlide, event.indexh, event.indexv
} );
Reveal.addEventListener( 'fragmentshown', ( event: FragmentEvent ) => {
// event.fragment = the fragment DOM element
} );
Reveal.addEventListener( 'fragmenthidden', ( event: FragmentEvent ) => {
// event.fragment = the fragment DOM element
} );
Reveal.slide( 1 );
// we're on slide 1
const state = Reveal.getState();
Reveal.slide( 3 );
// we're on slide 3
Reveal.setState( state );
// we're back on slide 1