This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require for node added Dead code removed Checking added Models/modules updated
- Loading branch information
Tomek Marchi
committed
Nov 23, 2015
1 parent
712fef2
commit c8b0764
Showing
13 changed files
with
514 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
$.pushApply=function(item,array){ | ||
var pushApply=function(item,array){ | ||
return _array_push.apply(item,array); | ||
} | ||
}; | ||
|
||
$.pushApply=pushApply; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,75 @@ | ||
var _model= (() => { | ||
//get model -> (bool) option for a lean model meaning no methods will be attached | ||
var model_function = (modelName, object, bool) => { | ||
if (hasValue(object)) { | ||
var model = _model[modelName] = object; | ||
if(_isFunction(model)){ | ||
model=model.bind(model); | ||
}else if(isPlainObject(model)){ | ||
_each_object(model,(item,key) => { | ||
if(_isFunction(item)){ | ||
model[key]=item.bind(model); | ||
} | ||
}); | ||
var _model = (() => { | ||
//get model -> (bool) option for a lean model meaning no methods will be attached | ||
var model_function = (modelName, object, bool) => { | ||
if (hasValue(object)) { | ||
var model = _model[modelName] = object; | ||
if (_isFunction(model)) { | ||
model = model.bind(model); | ||
} else if (isPlainObject(model)) { | ||
_each_object(model, (item, key) => { | ||
if (_isFunction(item)) { | ||
model[key] = item.bind(model); | ||
} | ||
}); | ||
} | ||
model.modelName = modelName; | ||
return model; | ||
} else if (_has(modelName, '.')) { | ||
return _find(modelName, _model); | ||
} | ||
return _model[modelName]; | ||
}; | ||
return model_function; | ||
})(), | ||
buildArgumentsMethod = (item) => { | ||
if (_isString(item)) { | ||
item = _find(item, $); | ||
} | ||
return item; | ||
}, | ||
requireAvailable=false, | ||
importScriptsAvailable=false, | ||
requireMethod =(()=>{ | ||
if(_global){ | ||
if(_global.require && !_global.importScripts){ | ||
return _global.require; | ||
}else if(_global.importScripts){ | ||
return _global.importScripts; | ||
} | ||
}else if(require){ | ||
return require; | ||
} | ||
})(), | ||
buildArgumentsRequireMethod = (item) => { | ||
if (_isString(item)) { | ||
item = requireMethod(item); | ||
} | ||
return item; | ||
}, | ||
define = (data) => { | ||
var funct = data.invoke, | ||
modelName = data.name, | ||
argsRequire = data.require, | ||
args = _each_array(data.import, buildArgumentsMethod), | ||
wrapFunct = function() { | ||
var freshArgs; | ||
if (arguments.length > 0) { | ||
freshArgs = _toArray(args); | ||
pushApply(freshArgs, arguments); | ||
} else { | ||
freshArgs = args; | ||
} | ||
model.modelName=modelName; | ||
return model; | ||
}else if (_has(modelName, '.')) { | ||
return _find(modelName, _model); | ||
} | ||
return _model[modelName]; | ||
}; | ||
return model_function; | ||
})(); | ||
return funct.apply(wrapFunct, freshArgs); | ||
}.bind(wrapFunct); | ||
if (modelName) { | ||
_model[modelName] = wrapFunct; | ||
} | ||
if (argsRequire) { | ||
pushApply(args, _each_array(argsRequire, buildArgumentsRequireMethod)); | ||
} | ||
|
||
return wrapFunct; | ||
}; | ||
|
||
$.model = _model; | ||
$.define = define; |
Oops, something went wrong.