allow specifying args type by passing objects (buttons values and preArgs)

This commit is contained in:
jean-emmanuel 2016-03-28 18:34:26 +02:00
parent abdec11094
commit 00a8b20bc7
2 changed files with 11 additions and 4 deletions

View file

@ -24,15 +24,20 @@ module.exports = function(ipc, settings) {
if (typeof args=='object' && args!==null) {
for (i in args) {
var arg = args[i]
if (typeof arg == 'number' && arg!==null) {
if (typeof arg == 'number' && arg!==null && typeof arg != 'object') {
message.append({type:numberType,value:arg})
} else if (arg!==null){
} else if (arg!==null && typeof arg != 'object'){
message.append({type:'string',value:String(arg)})
}
} else if (arg!==null && typeof arg == 'object' && arg.type && arg.value!=undefined) {
message.append({type:arg.type,value:arg.value})
}
}
} else if (args!==null){
if (typeof args == 'number') {
message.append({type:numberType,value:args})
} else if (typeof args == 'object' && arg.type && arg.value!=undefined) {
message.append({type:args.type,value:args.value})
} else {
message.append({type:'string',value:String(args)})
}