The internal plumbing has been restructured so that:
The Component layering of ComponentStack remains but the return value from ComponentStack#push() is now an object with the component and promise associated with the layer.
All widget entry-points now return instances of the base class A0Widget that contains the architecture to defer calls until component mounting while maintaining transactional functionality (either through callback or returned Promise). A0Widget is also an instance of an EventEmitter and has the logic to map Component callback props to events.
This means you can do something like this:
var editor = window.webtaskWidget.createEditor({
mount: document.getElementById('editor'),
storeProfile: true,
});
// You can listen for events on the returned 'smart' object
editor.on('save', function (webtask) {
console.log('save event', webtask);
});
// You can also initiate a save intent that will get executed once login and/or
// profile retrieval has completed. The save method can accept a node-style
// callback and will return a Promise. If the user fails to log in, an error will
// be sent to the node-style callback and the Promise will be rejected.
editor.save()
.then(function (webtask) {
console.log('saved webtask', webtask);
}, function (err) {
console.log('error saving webtask', err);
});
The internal plumbing has been restructured so that:
ComponentStack
remains but the return value fromComponentStack#push()
is now an object with thecomponent
andpromise
associated with the layer.A0Widget
that contains the architecture to defer calls until component mounting while maintaining transactional functionality (either through callback or returnedPromise
).A0Widget
is also an instance of anEventEmitter
and has the logic to map Component callback props to events.This means you can do something like this: