extjs-custom
Advanced tools
Comparing version
41
Ext.js
@@ -235,12 +235,5 @@ var enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable','toLocaleString', 'toString', 'constructor'] | ||
}, | ||
} | ||
//http://stackoverflow.com/questions/20129236/creating-functions-dynamically-in-js | ||
// | ||
Ext.functionFactory= function() { | ||
var me = this, | ||
args = Array.prototype.slice.call(arguments), | ||
ln; | ||
/** | ||
* Customized version of Ext's functionFactory method | ||
* Alternative way of Sandboxing needed. To get Ext in scope of the function produced by Ext.functionFactory | ||
@@ -250,14 +243,26 @@ * Make sure to add scope.ExtReference=Ext when you call the produced function | ||
* var f = Ext.functionFactory("return 'stuff'""); | ||
* date.ExtReference = Ext; | ||
* date.ExtReference = Ext; // <-- adding a reference to Ext in the scope of where the function is called in | ||
* return f.call(date); | ||
* | ||
* About creating functions with dynamic code (last line of functionFactory) | ||
* - http://stackoverflow.com/questions/20129236/creating-functions-dynamically-in-js | ||
* - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function | ||
*/ | ||
if (true) { | ||
ln = args.length; | ||
if (ln > 0) { | ||
ln--; | ||
args[ln] = 'var Ext=this.ExtReference;' + args[ln]; | ||
} | ||
functionFactory: function() { | ||
var me = this, | ||
args = Array.prototype.slice.call(arguments), | ||
ln; | ||
//Start adding sandboxing | ||
if (true) { | ||
ln = args.length; | ||
if (ln > 0) { | ||
ln--; | ||
args[ln] = 'var Ext=this.ExtReference;' + args[ln]; | ||
} | ||
} | ||
//End adding sandboxing | ||
return Function.prototype.constructor.apply(Function.prototype, args); | ||
} | ||
return Function.prototype.constructor.apply(Function.prototype, args); | ||
}; | ||
@@ -264,0 +269,0 @@ |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"repository": { | ||
@@ -12,0 +12,0 @@ "type" : "git", |
177618
0.23%4020
0.12%