Reveal.configure() now works pre-initialization
This commit is contained in:
parent
5e4c5c33a9
commit
eb026f79b4
2
dist/reveal.esm.js
vendored
2
dist/reveal.esm.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js
vendored
2
dist/reveal.js
vendored
File diff suppressed because one or more lines are too long
|
@ -45,7 +45,7 @@ Reveal.initialize = options => {
|
||||||
* queuing up premature API calls and invoking all
|
* queuing up premature API calls and invoking all
|
||||||
* of them when Reveal.initialize is called.
|
* of them when Reveal.initialize is called.
|
||||||
*/
|
*/
|
||||||
[ 'on', 'off', 'addEventListener', 'removeEventListener', 'registerPlugin' ].forEach( method => {
|
[ 'configure', 'on', 'off', 'addEventListener', 'removeEventListener', 'registerPlugin' ].forEach( method => {
|
||||||
Reveal[method] = ( ...args ) => {
|
Reveal[method] = ( ...args ) => {
|
||||||
enqueuedAPICalls.push( deck => deck[method].call( null, ...args ) );
|
enqueuedAPICalls.push( deck => deck[method].call( null, ...args ) );
|
||||||
}
|
}
|
||||||
|
|
12
js/reveal.js
12
js/reveal.js
|
@ -47,7 +47,7 @@ export default function( revealElement, options ) {
|
||||||
const Reveal = {};
|
const Reveal = {};
|
||||||
|
|
||||||
// Configuration defaults, can be overridden at initialization time
|
// Configuration defaults, can be overridden at initialization time
|
||||||
let config,
|
let config = {},
|
||||||
|
|
||||||
// Flags if reveal.js is loaded (has dispatched the 'ready' event)
|
// Flags if reveal.js is loaded (has dispatched the 'ready' event)
|
||||||
ready = false,
|
ready = false,
|
||||||
|
@ -125,8 +125,14 @@ export default function( revealElement, options ) {
|
||||||
dom.wrapper = revealElement;
|
dom.wrapper = revealElement;
|
||||||
dom.slides = revealElement.querySelector( '.slides' );
|
dom.slides = revealElement.querySelector( '.slides' );
|
||||||
|
|
||||||
// Compose our config object
|
// Compose our config object in order of increasing precedence:
|
||||||
config = { ...defaultConfig, ...options, ...initOptions, ...Util.getQueryHash() };
|
// 1. Default reveal.js options
|
||||||
|
// 2. Options provided via Reveal.configure() prior to
|
||||||
|
// initialization
|
||||||
|
// 3. Options passed to the Reveal constructor
|
||||||
|
// 4. Options passed to Reveal.initialize
|
||||||
|
// 5. Query params
|
||||||
|
config = { ...defaultConfig, ...config, ...options, ...initOptions, ...Util.getQueryHash() };
|
||||||
|
|
||||||
setViewport();
|
setViewport();
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,8 @@
|
||||||
<script>
|
<script>
|
||||||
window.location.hash = '';
|
window.location.hash = '';
|
||||||
|
|
||||||
|
Reveal.configure({maxScale: 1.11});
|
||||||
|
|
||||||
// These tests expect the DOM to contain a presentation
|
// These tests expect the DOM to contain a presentation
|
||||||
// with the following slide structure:
|
// with the following slide structure:
|
||||||
//
|
//
|
||||||
|
@ -113,6 +115,10 @@
|
||||||
|
|
||||||
QUnit.module( 'API' );
|
QUnit.module( 'API' );
|
||||||
|
|
||||||
|
QUnit.test( 'Reveal.configure before initialization', function( assert ) {
|
||||||
|
assert.strictEqual( Reveal.getConfig().maxScale, 1.11 );
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test( 'Reveal.isReady', function( assert ) {
|
QUnit.test( 'Reveal.isReady', function( assert ) {
|
||||||
assert.strictEqual( Reveal.isReady(), true, 'returns true' );
|
assert.strictEqual( Reveal.isReady(), true, 'returns true' );
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user