mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-11 20:21:03 +00:00
Fix the argument passing convention
This commit is contained in:
parent
e4a8357715
commit
82ac8e5d02
|
@ -334,7 +334,8 @@ namespace WelsonJS.Service
|
|||
object[] parameters = new object[] {
|
||||
scriptName,
|
||||
eventType,
|
||||
new ArrayList(args)
|
||||
new ArrayList(args),
|
||||
args.Length
|
||||
};
|
||||
//scriptControl.AddObject("extern_arguments", new ArrayList(args), true);
|
||||
|
||||
|
|
10
app.js
10
app.js
|
@ -592,8 +592,14 @@ function initializeWindow(name, args, w, h) {
|
|||
}
|
||||
}
|
||||
|
||||
function dispatchServiceEvent(name, eventType, w_args) {
|
||||
function dispatchServiceEvent(name, eventType, w_args, argl) {
|
||||
var app = require(name);
|
||||
var args = [];
|
||||
|
||||
// convert the arguments to Array
|
||||
for (var i = 0; i < argl; i++) {
|
||||
args.push(w_args(i));
|
||||
}
|
||||
|
||||
// load the service
|
||||
if (app) {
|
||||
|
@ -610,7 +616,7 @@ function dispatchServiceEvent(name, eventType, w_args) {
|
|||
if (eventType in action) {
|
||||
try {
|
||||
return (function(f) {
|
||||
return (typeof f !== "function" ? null : f(w_args));
|
||||
return (typeof f !== "function" ? null : f(args));
|
||||
})(action[eventType]);
|
||||
} catch (e) {
|
||||
console.error("Exception:", e.message);
|
||||
|
|
|
@ -21,11 +21,11 @@ function onServiceElapsedTime() {
|
|||
}
|
||||
|
||||
function onMessageReceived() {
|
||||
return "onMessageReceived recevied. " + args.join(', ');
|
||||
return "onMessageReceived recevied. " + args.join(', ');
|
||||
}
|
||||
|
||||
function onServiceScreenTime(args) {
|
||||
return "onServiceScreenTime recevied. " + args(0);
|
||||
return "onServiceScreenTime recevied. " + args.join(', ');
|
||||
}
|
||||
|
||||
function onFileCreated(args) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user