|
|
@ -11,6 +11,9 @@ var getScope = function (unit,configs) {
|
|
|
|
var viewModel = {};
|
|
|
|
var viewModel = {};
|
|
|
|
var cbResult;
|
|
|
|
var cbResult;
|
|
|
|
if (jsFile.isExists()) {
|
|
|
|
if (jsFile.isExists()) {
|
|
|
|
|
|
|
|
if(fuseState.viewModelCache[jsFile.getPath()]){
|
|
|
|
|
|
|
|
cbResult = fuseState.viewModelCache[jsFile.getPath()];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
script = require(jsFile.getPath());
|
|
|
|
script = require(jsFile.getPath());
|
|
|
|
//Eagerly make the viewModel the template configs
|
|
|
|
//Eagerly make the viewModel the template configs
|
|
|
|
viewModel = templateConfigs;
|
|
|
|
viewModel = templateConfigs;
|
|
|
@ -25,6 +28,10 @@ var getScope = function (unit,configs) {
|
|
|
|
onRequestCb = script.onRequest;
|
|
|
|
onRequestCb = script.onRequest;
|
|
|
|
cbResult = onRequestCb(templateConfigs);
|
|
|
|
cbResult = onRequestCb(templateConfigs);
|
|
|
|
log.debug("passing configs to unit "+unit+" configs: "+stringify(templateConfigs));
|
|
|
|
log.debug("passing configs to unit "+unit+" configs: "+stringify(templateConfigs));
|
|
|
|
|
|
|
|
fuseState.viewModelCache[jsFile.getPath()] = cbResult;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//If the execution does not yield an object we will print
|
|
|
|
//If the execution does not yield an object we will print
|
|
|
|
//a warning as the unit author may have forgotten to return a data object
|
|
|
|
//a warning as the unit author may have forgotten to return a data object
|
|
|
|
if(cbResult===undefined){
|
|
|
|
if(cbResult===undefined){
|
|
|
@ -34,7 +41,6 @@ var getScope = function (unit,configs) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
viewModel = cbResult;
|
|
|
|
viewModel = cbResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
//If there is no script then the view should get the configurations
|
|
|
|
//If there is no script then the view should get the configurations
|
|
|
|
//passed in the unit call
|
|
|
|
//passed in the unit call
|
|
|
|