Support BEMContext from exports
blond opened this issue · 3 comments
blond commented
Now we extend the definition of the basic templates with oninit
. The BEMContext
is available from context
argument.
oninit(function(exports, context) {
if(!context.BEMContext) {
throw Error("Seems like you have no base templates from i-bem.' + this.getName() + '");
}
context.BEMContext.prototype.require = function(lib) {',
return __bem_xjst_libs__[lib];
};
});
In bem-core@v3
BEMContext
wiil be available from exports
argument only.
tormozz48 commented
Can we write as such way?
oninit(function(exports, context) {
var BEMContext = context.BEMContext || exports.BEMContext;
if(!BEMContext) {
throw Error("Seems like you have no base templates from i-bem.' + this.getName() + '");
}
BEMContext.prototype.require = function(lib) {',
return __bem_xjst_libs__[lib];
};
});
blond commented
I think yes.
I would have swapped exports
and context
:
var BEMContext = exports.BEMContext || context.BEMContext;
/cc @tadatuta
arikon commented
As for me — :ok: