Change gc.lib.addCallback to gc.lib.pushCallback (#626)

This commit is contained in:
Henrik Ingo
2017-11-01 15:00:03 +02:00
parent 2d229bf4a6
commit d6c6cd47c2
9 changed files with 22 additions and 22 deletions

View File

@@ -971,12 +971,12 @@
pushEventListener( target, type, listenerFunction ); pushEventListener( target, type, listenerFunction );
}; };
// `addCallback` If the above utilities are not enough, plugins can add their own callback // `pushCallback` If the above utilities are not enough, plugins can add their own callback
// function to do arbitrary things. // function to do arbitrary things.
var addCallback = function( callback ) { var pushCallback = function( callback ) {
callbackList.push( callback ); callbackList.push( callback );
}; };
addCallback( function( rootId ) { resetStartingState( rootId ); } ); pushCallback( function( rootId ) { resetStartingState( rootId ); } );
// `teardown` will // `teardown` will
// - execute all callbacks in LIFO order // - execute all callbacks in LIFO order
@@ -1009,7 +1009,7 @@
appendChild: appendChild, appendChild: appendChild,
pushEventListener: pushEventListener, pushEventListener: pushEventListener,
addEventListener: addEventListener, addEventListener: addEventListener,
addCallback: addCallback, pushCallback: pushCallback,
teardown: teardown teardown: teardown
}; };
roots[ rootId ] = lib; roots[ rootId ] = lib;
@@ -1294,7 +1294,7 @@
addToolbarButton( toolbar ); addToolbarButton( toolbar );
} }
api.lib.gc.addCallback( function() { api.lib.gc.pushCallback( function() {
clearTimeout( timeoutHandle ); clearTimeout( timeoutHandle );
} ); } );
@@ -1911,7 +1911,7 @@
// Regster callback to empty the help div on teardown // Regster callback to empty the help div on teardown
var api = e.detail.api; var api = e.detail.api;
api.lib.gc.addCallback( function() { api.lib.gc.pushCallback( function() {
window.clearTimeout( timeoutHandle ); window.clearTimeout( timeoutHandle );
helpDiv.style.display = ""; helpDiv.style.display = "";
helpDiv.innerHTML = ""; helpDiv.innerHTML = "";
@@ -2728,7 +2728,7 @@
// Unset all this on teardown // Unset all this on teardown
var api = event.detail.api; var api = event.detail.api;
api.lib.gc.addCallback( function() { api.lib.gc.pushCallback( function() {
document.body.classList.remove( "impress-mobile" ); document.body.classList.remove( "impress-mobile" );
var prev = document.getElementsByClassName( "prev" )[ 0 ]; var prev = document.getElementsByClassName( "prev" )[ 0 ];
var next = document.getElementsByClassName( "next" )[ 0 ]; var next = document.getElementsByClassName( "next" )[ 0 ];
@@ -2825,7 +2825,7 @@
show(); show();
// Unset all this on teardown // Unset all this on teardown
gc.addCallback( function() { gc.pushCallback( function() {
window.clearTimeout( timeoutHandle ); window.clearTimeout( timeoutHandle );
document.body.classList.remove( "impress-mouse-timeout" ); document.body.classList.remove( "impress-mouse-timeout" );
} ); } );
@@ -3150,7 +3150,7 @@
root = event.target; root = event.target;
getSteps(); getSteps();
var gc = event.detail.api.lib.gc; var gc = event.detail.api.lib.gc;
gc.addCallback( function() { gc.pushCallback( function() {
stepids = []; stepids = [];
if ( progressbar ) { if ( progressbar ) {
progressbar.style.width = ""; progressbar.style.width = "";
@@ -3336,7 +3336,7 @@
// Register teardown callback to reset the data.x, .y, .z values. // Register teardown callback to reset the data.x, .y, .z values.
document.addEventListener( "impress:init", function( event ) { document.addEventListener( "impress:init", function( event ) {
var root = event.target; var root = event.target;
event.detail.api.lib.gc.addCallback( function() { event.detail.api.lib.gc.pushCallback( function() {
var steps = startingState[ root.id ]; var steps = startingState[ root.id ];
var step; var step;
while ( step = steps.pop() ) { while ( step = steps.pop() ) {
@@ -3848,7 +3848,7 @@
document.addEventListener( "impress:init", function( event ) { document.addEventListener( "impress:init", function( event ) {
var api = event.detail.api; var api = event.detail.api;
api.lib.gc.addCallback( function() { api.lib.gc.pushCallback( function() {
toolbar.innerHTML = ""; toolbar.innerHTML = "";
groups = []; groups = [];
} ); } );

View File

@@ -55,12 +55,12 @@
pushEventListener( target, type, listenerFunction ); pushEventListener( target, type, listenerFunction );
}; };
// `addCallback` If the above utilities are not enough, plugins can add their own callback // `pushCallback` If the above utilities are not enough, plugins can add their own callback
// function to do arbitrary things. // function to do arbitrary things.
var addCallback = function( callback ) { var pushCallback = function( callback ) {
callbackList.push( callback ); callbackList.push( callback );
}; };
addCallback( function( rootId ) { resetStartingState( rootId ); } ); pushCallback( function( rootId ) { resetStartingState( rootId ); } );
// `teardown` will // `teardown` will
// - execute all callbacks in LIFO order // - execute all callbacks in LIFO order
@@ -93,7 +93,7 @@
appendChild: appendChild, appendChild: appendChild,
pushEventListener: pushEventListener, pushEventListener: pushEventListener,
addEventListener: addEventListener, addEventListener: addEventListener,
addCallback: addCallback, pushCallback: pushCallback,
teardown: teardown teardown: teardown
}; };
roots[ rootId ] = lib; roots[ rootId ] = lib;

View File

@@ -41,7 +41,7 @@
addToolbarButton( toolbar ); addToolbarButton( toolbar );
} }
api.lib.gc.addCallback( function() { api.lib.gc.pushCallback( function() {
clearTimeout( timeoutHandle ); clearTimeout( timeoutHandle );
} ); } );

View File

@@ -105,7 +105,7 @@
// Regster callback to empty the help div on teardown // Regster callback to empty the help div on teardown
var api = e.detail.api; var api = e.detail.api;
api.lib.gc.addCallback( function() { api.lib.gc.pushCallback( function() {
window.clearTimeout( timeoutHandle ); window.clearTimeout( timeoutHandle );
helpDiv.style.display = ""; helpDiv.style.display = "";
helpDiv.innerHTML = ""; helpDiv.innerHTML = "";

View File

@@ -51,7 +51,7 @@
// Unset all this on teardown // Unset all this on teardown
var api = event.detail.api; var api = event.detail.api;
api.lib.gc.addCallback( function() { api.lib.gc.pushCallback( function() {
document.body.classList.remove( "impress-mobile" ); document.body.classList.remove( "impress-mobile" );
var prev = document.getElementsByClassName( "prev" )[ 0 ]; var prev = document.getElementsByClassName( "prev" )[ 0 ];
var next = document.getElementsByClassName( "next" )[ 0 ]; var next = document.getElementsByClassName( "next" )[ 0 ];

View File

@@ -58,7 +58,7 @@
show(); show();
// Unset all this on teardown // Unset all this on teardown
gc.addCallback( function() { gc.pushCallback( function() {
window.clearTimeout( timeoutHandle ); window.clearTimeout( timeoutHandle );
document.body.classList.remove( "impress-mouse-timeout" ); document.body.classList.remove( "impress-mouse-timeout" );
} ); } );

View File

@@ -19,7 +19,7 @@
root = event.target; root = event.target;
getSteps(); getSteps();
var gc = event.detail.api.lib.gc; var gc = event.detail.api.lib.gc;
gc.addCallback( function() { gc.pushCallback( function() {
stepids = []; stepids = [];
if ( progressbar ) { if ( progressbar ) {
progressbar.style.width = ""; progressbar.style.width = "";

View File

@@ -146,7 +146,7 @@
// Register teardown callback to reset the data.x, .y, .z values. // Register teardown callback to reset the data.x, .y, .z values.
document.addEventListener( "impress:init", function( event ) { document.addEventListener( "impress:init", function( event ) {
var root = event.target; var root = event.target;
event.detail.api.lib.gc.addCallback( function() { event.detail.api.lib.gc.pushCallback( function() {
var steps = startingState[ root.id ]; var steps = startingState[ root.id ];
var step; var step;
while ( step = steps.pop() ) { while ( step = steps.pop() ) {

View File

@@ -147,7 +147,7 @@
document.addEventListener( "impress:init", function( event ) { document.addEventListener( "impress:init", function( event ) {
var api = event.detail.api; var api = event.detail.api;
api.lib.gc.addCallback( function() { api.lib.gc.pushCallback( function() {
toolbar.innerHTML = ""; toolbar.innerHTML = "";
groups = []; groups = [];
} ); } );