Closed sgrebnov closed 10 years ago
Created issue CB-6481 to cover this work. Switched to nodejs module loader. Sample hook file implementation with async functionality:
var Q = require('./q');
module.exports = function(context) {
console.log('hook.js>> platform: ' + context.platform);
console.log('hook.js>> projectDir: ' + context.projectDir);
console.log('hook.js>> pluginDir: ' + context.pluginDir);
console.log('hook.js>> cmdLine: ' + context.cmdLine);
var deferral = new Q.defer();
setTimeout(function(){
deferral.resolve();
}, 1000);
return deferral.promise;
}
Switched to single parameter called context
@agrieve, thx for review; updated the code. Also did rebase
Adding a couple of unit tests will be great :cop:
Totally agree, will do as soon as cordova-lib work is stabilized so I can move the code to appropriate repo and perform final tests. @ligaz, thx for review.
Moved to appropriate repo, closing... https://github.com/apache/cordova-lib/pull/12
1.Support of js script files only (nodejs is used to run script file)
2.Support of the following hook types
uninstall – run after plugin is uninstalled
3.Use context argument to retrieve execution parameters inside hook function