Strict mode and Dojo declare - Workaround 1
by Deepak Anand
JavaScript
// Dojo-declare's this.inherited() call breaks strict mode
// Below is a solution from
// https://github.com/Microsoft/TypeScript/issues/3576#issuecomment-178397108
require([
"dojo/_base/declare"
], function(declare){
'use strict';
var SuperClass = declare(null, {
superMethod: function(a, b, c){
console.log('in super class');
console.log(a+b+c);
}
});
var MixinClass = declare(null, {
superMethod: function superMethod(a, b, c){
console.log('in mixin');
this.inherited({callee: superMethod}, arguments);
}
});
var SubClass = declare([SuperClass,MixinClass], {
// Named function expression
superMethod: function superMethod(a, b, c){
// sub class
console.log('in sub-class');
this.inherited({callee: superMethod}, arguments);
}
});
var subclassInstance = new SubClass();
subclassInstance.superMethod(1, 2, 3);
});