Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a reInitSlidesArray method for extensions that generate new slide... #161

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion core/deck.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ that use the API provided by core.
initSlidesArray(options.selectors.slides);
// Pre init event for preprocessing hooks
beforeInitEvent.done = function() {
// reInitSlidesArray is meant only for beforeInit
methods['reInitSlidesArray'] = function() {
alert('Deck.js method "reInitSlidesArray" is meant to be called in the beforeInit phase only.');
}
// re-populate the array of slides
slides = [];
initSlidesArray(options.selectors.slides);
Expand Down Expand Up @@ -427,6 +431,19 @@ that use the API provided by core.
}, options.initLockTimeout);
},

/*
jQuery.deck('reInitSlidesArray')

Force a recomputation of the "slides" array. This method is meant
to be used by extensions that generate new slides in the
beforeInit phase.
*/

reInitSlidesArray: function() {
slides = [];
initSlidesArray(options.selectors.slides);
},

/*
jQuery.deck('go', index)

Expand Down Expand Up @@ -601,7 +618,12 @@ that use the API provided by core.
return methods[method].apply(this, args);
}
else {
return methods.init(method, arg);
if (window.defaultDeckCallIsAnError) {
alert("'" + method + "' not found (or meant to be a parameter-less init)");
}
else {
return methods.init(method, arg);
}
}
};

Expand Down