Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Medium = function(fn, args){
- var __fn = cloneFunction(fn);
- var __length = fn.length;
- var __args = args.length >= fn.length ? args : fill(fn.length, args);
- var __self = this;
- this.getFn = function(){ return cloneFunction(__fn) };
- ...
- }
- Medium.prototype.pass = function(sprdArgs){
- var fnArgs = this.getArgs();
- return arguments.length > 0
- ? this.use("load", arguments)
- : this.use("update", fnArgs);
- }
- ...
- var Medium = function(fn, args){
- ...
- this.method = function(thisArg, funcName, args){
- var funcs = {
- load: function(args){ ... },
- update: function(params){ ... },
- execute: function(){ ... }
- };
- return thisArg === __self
- ? funcs[funcName].apply(thisArg, args)
- : null;
- }
- }
- Medium.prototype.use = function(funcName, sprdArgs){
- var args = clone(arguments);
- var sprdArgs = filter(args, function(elem, i){
- return i !== 0;
- });
- return this.method(this, funcName, sprdArgs);
- }
Add Comment
Please, Sign In to add comment