Here you can find the source of bind( obj )
Function.prototype.bind = function( obj ) { var slice = [].slice, args = slice.call(arguments, 1), self = this, //from ww w . j ava2 s.co m nop = function () {}, bound = function () { return self.apply( this instanceof nop ? this : ( obj || {} ), args.concat( slice.call(arguments) ) ); }; nop.prototype = self.prototype; bound.prototype = new nop(); return bound; }; String.prototype.pluralize = function(count) { return count + ' ' + this + (count == 1 ? '' : 's'); }; Array.prototype.random = function(){ return this[Math.floor(Math.random() * this.length)]; }; Array.prototype.remove = function(from, to) { var rest = this.slice((to || from) + 1 || this.length); this.length = from < 0 ? this.length + from : from; return this.push.apply(this, rest); }; //https://github.com/appcelerator/KitchenSink/blob/master/Resources/examples/version.js function isiOS4Plus(){ if (Titanium.Platform.name == 'iPhone OS'){ var version = Titanium.Platform.version.split("."); var major = parseInt(version[0]); if (major >= 4) return true; } return false; }
Function.prototype.bind = function(scope) { var _function = this; return function() { return _function.apply(scope, arguments); }; String.prototype.trim = function () { return this.replace(/^\s*/, '').replace(/\s*$/, ''); }; ...
Function.prototype.bind = function(scope) { var _function = this; return function() { return _function.apply(scope, arguments);
Function.prototype.bind = function bind(self) { var callable = this; return function binding() { return callable.apply(self, arguments.toArray()); };
Function.prototype.bind = Function.prototype.bind || function (oThis) { if( typeof this !== "function" ) { throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function () {}, fBound = function () { return fToBind.apply( ...
Function.prototype.bind = function(scope) { var func = this; return function() { return func.apply(scope, arguments); }; };
Function.prototype.bind = function (bind) { var self = this; return function () { var args = Array.prototype.slice.call(arguments); return self.apply(bind || null, args); }; };
Function.prototype.rebind = function (n) { var me = this; return function () { var res = me.apply(); var f = res && res[n]; if(typeof f !== 'function') throw 'routed property was not a function.'; f.apply(null, arguments); }; }; ...
Function.prototype.bind = function(scope) { var _function = this; return function() { return _function.apply(scope, arguments); };
Function.prototype.pass = function(args, bind){ var self = this; if (args != null) args = Array.from(args); return function(){ return self.apply(bind, args || arguments); }; }; Element.prototype.hasClass = function(className){ return this.className.indexOf(className) != -1; ...