-
Notifications
You must be signed in to change notification settings - Fork 1
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
Run time consuming functions before removing snippets ( teardown phase ) #34
Comments
Hi, yes there is, but not using the standard Each transaction will emit the As an example the transaction itself has an internal Promise whose fulfillment is tied to the So ultimately what you want to do is make at least the transition's var PluginInitializer = _context.extend(function(page) {
this._ = {
page: page
};
this._.page.on('transaction-created', this._handleTransaction.bind(this));
}, {
_handleTransaction: function(evt) {
evt.data.transaction.on('snippets-apply', this._handleSnippets.bind(this));
},
_handleSnippets: function(evt) {
var snippetId = 'snippet--modal',
changeset = evt.data.changeset;
if (snippetId in changeset.add || snippetId in changeset.update || snippetId in changeset.remove) {
// if the snippet id we're watching for appears in the changeset,
// we tell the snippet agent to wait until the modal is closed
// before actually applying the snippets and allowing the transaction
// to be resolved
evt.waitFor(this._closeModal());
}
},
_closeModal: function() {
return new Promise(function(fulfill) {
// ...
});
}
}); |
Btw, for future reference, Nittro now has a forum where you can ask questions, no need to abuse Github Issues ;-) |
You can check the code of the various transaction agents that Nittro itself uses to give you an idea of what's possible and how it works - check out the Page component's repository |
Oh great! .. thanks a lot |
Hi, i have another question.
Is there a way to suspend execution of functions after
teardown
of some snippet orbefore-update
event until actions are done in mentioned functions?For example i have this code:
so i need to wait for animation to be done before modal snippet is removed. I'm using standard bootstrap modal. I'm automatically opening modal after it is added to DOM in
_afterUpdate
functionThe text was updated successfully, but these errors were encountered: