mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-13 13:11: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[] {
|
object[] parameters = new object[] {
|
||||||
scriptName,
|
scriptName,
|
||||||
eventType,
|
eventType,
|
||||||
new ArrayList(args)
|
new ArrayList(args),
|
||||||
|
args.Length
|
||||||
};
|
};
|
||||||
//scriptControl.AddObject("extern_arguments", new ArrayList(args), true);
|
//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 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
|
// load the service
|
||||||
if (app) {
|
if (app) {
|
||||||
|
@ -610,7 +616,7 @@ function dispatchServiceEvent(name, eventType, w_args) {
|
||||||
if (eventType in action) {
|
if (eventType in action) {
|
||||||
try {
|
try {
|
||||||
return (function(f) {
|
return (function(f) {
|
||||||
return (typeof f !== "function" ? null : f(w_args));
|
return (typeof f !== "function" ? null : f(args));
|
||||||
})(action[eventType]);
|
})(action[eventType]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Exception:", e.message);
|
console.error("Exception:", e.message);
|
||||||
|
|
|
@ -21,11 +21,11 @@ function onServiceElapsedTime() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMessageReceived() {
|
function onMessageReceived() {
|
||||||
return "onMessageReceived recevied. " + args.join(', ');
|
return "onMessageReceived recevied. " + args.join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onServiceScreenTime(args) {
|
function onServiceScreenTime(args) {
|
||||||
return "onServiceScreenTime recevied. " + args(0);
|
return "onServiceScreenTime recevied. " + args.join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFileCreated(args) {
|
function onFileCreated(args) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user