From abdec110945c36bd59069d6a7af4992087033e40 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 28 Mar 2016 18:21:57 +0200 Subject: [PATCH] use "null" value to send osc messages without any argument --- main/osc.js | 8 ++++---- resources/docs/widgets/buttons.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main/osc.js b/main/osc.js index b64cd509..d8779368 100644 --- a/main/osc.js +++ b/main/osc.js @@ -21,16 +21,16 @@ module.exports = function(ipc, settings) { var numberType = precision==0?'integer':'float' - if (typeof args=='object') { + if (typeof args=='object' && args!==null) { for (i in args) { var arg = args[i] - if (typeof arg == 'number') { + if (typeof arg == 'number' && arg!==null) { message.append({type:numberType,value:arg}) - } else { + } else if (arg!==null){ message.append({type:'string',value:String(arg)}) } } - } else { + } else if (args!==null){ if (typeof args == 'number') { message.append({type:numberType,value:args}) } else { diff --git a/resources/docs/widgets/buttons.md b/resources/docs/widgets/buttons.md index 4a12d455..25f38588 100644 --- a/resources/docs/widgets/buttons.md +++ b/resources/docs/widgets/buttons.md @@ -5,15 +5,15 @@ Buttons are exactly what you think they are. ## toggle ```js type:'toggle', -on: 1, // [string|number|false] value sent when toggle is on (false to prevent sending ) -off:0, // [string|number|false] value sent when toggle is off (false to prevent sending ) +on: 1, // [string|number|false|null] value sent when toggle is on (false to prevent sending, null to send no arg) +off:0, // [string|number|false|null] value sent when toggle is off (false to prevent sending, null to send no arg) ``` ## push ```js type:'push', -on: 1, // [string|number|false] value sent when toggle is on (false to prevent sending ) -off:0, // [string|number|false] value sent when toggle is off (false to prevent sending ) +on: 1, // [string|number|false|null] value sent when toggle is on (false to prevent sending, null to send no arg) +off:0, // [string|number|false|null] value sent when toggle is off (false to prevent sending, null to send no arg) ``` ## switch