From 13c7aae7c986973f25f7de94a72e341d4ed96c70 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 8 Oct 2016 00:13:19 +0200 Subject: [PATCH] osc: `true` and `false` values are now properly sent as boolean --- CHANGELOG.md | 1 + app/main/osc.js | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ae08b81..e33c3977 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - make push's backlight only respond to external osc messages (not to synchronization messages from other widgets or clients) - remove special `false` value case for push/toggles (which used to disable osc sending) - add `norelease` option to `push` for disabling osc messages when releasing the button + - `true` and `false` values are now properly sent as boolean - misc - rewritten matrices with prototypes inheritance diff --git a/app/main/osc.js b/app/main/osc.js index 147c00b8..3e2829f1 100644 --- a/app/main/osc.js +++ b/app/main/osc.js @@ -14,7 +14,7 @@ if (oscInPort) { ipc.send('receiveOsc',data) if (debug) console.log('OSC received: ',data, 'From : ' + rinfo.address + ':' + rinfo.port) }) - + } module.exports = { @@ -33,10 +33,11 @@ module.exports = { if (typeof args=='object' && args!==null) { for (i in args) { var arg = args[i] - if (typeof arg == 'number' && arg!==null && typeof arg != 'object') { message.append({type:numberType,value:arg}) - } else if (arg!==null && typeof arg != 'object'){ + } else if (typeof arg == "boolean") { + message.append({type:"boolean",value:arg}) + } 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}) @@ -45,7 +46,9 @@ module.exports = { } else if (args!==null){ if (typeof args == 'number') { message.append({type:numberType,value:args}) - } else if (typeof args == 'object' && arg.type && arg.value!=undefined) { + } else if (typeof args == "boolean") { + message.append({type:"boolean",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)})