engine
engine copied to clipboard
Async helpers support
Will be good to support it out of the box.
With https://github.com/doowb/async-helpers/pull/19 it will be nothing more than just calling its .set. If the helper is regular async or callback async function it will be handled/wrapped by the async-helpers, otherwise it will be just set in the this.helpers. With .get() you will get both the wrapped and non-wrapped ones.
helper(prop, fn) {
if (utils.isObject(prop)) {
this.helpers(prop);
} else {
this.asyncHelpers.set(prop, fn);
}
return this;
}
helpers(helpers) {
this.asyncHelpers.set(helpers);
return this;
}
// later merge `this.imports` and `this.asyncHelpers.helpers`
Probably would be good thing to just rename the this.helpers in async-helpers to be this.imports so will be able to extend the AsyncHelpers class here.