From 07201d8427c6c53b816fa4cea7b744f6dae7c679 Mon Sep 17 00:00:00 2001 From: bordun Date: Thu, 15 Oct 2020 11:00:35 +0200 Subject: [PATCH] remote-control: add `/SESSION/OPEN` and `/SESSION/SAVE` commands --- CHANGELOG.md | 3 +++ resources/docs/docs/remote-control.md | 12 ++++++++++++ src/client/remote-control.js | 17 +++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60bde4d6..437328a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ - fullscreen: lack of support not detected on some ios devices - multixy: labels not hidden when `ephemeral` is `true` +- remote control + - add `/SESSION/OPEN` and `/SESSION/SAVE` commands + ## 1.5.1 - bug fixes diff --git a/resources/docs/docs/remote-control.md b/resources/docs/docs/remote-control.md index ef79e860..bbc0833d 100644 --- a/resources/docs/docs/remote-control.md +++ b/resources/docs/docs/remote-control.md @@ -169,3 +169,15 @@ Save the state of all widgets in the temporary slot. #### `/STATE/RECALL` Reload saved state from the temporary slot. + +---- + +#### `/SESSION/OPEN path.json` + +Open session file `path.json`. + +---- + +#### `/SESSION/SAVE path.json` + +Save current session to `path.json`. If `path.json` is omitted, current session's path is used. diff --git a/src/client/remote-control.js b/src/client/remote-control.js index 560a5864..5dd59920 100644 --- a/src/client/remote-control.js +++ b/src/client/remote-control.js @@ -2,6 +2,7 @@ var {updateWidget} = require('./editor/data-workers'), editor = require('./editor'), widgetManager = require('./managers/widgets'), stateManager = require('./managers/state'), + sessionManager = require('./managers/session'), deepExtend = require('deep-extend'), notifications = require('./ui/notifications') @@ -231,6 +232,22 @@ var callbacks = { }) }, + '/SESSION/OPEN': function(args) { + + if (!Array.isArray(args)) args = [args] + + if (typeof args === 'string') sessionManager.requestOpen(args[0]) + + }, + '/SESSION/SAVE': function(args) { + + if (!Array.isArray(args)) args = [args] + + sessionManager.save(args[0]) + + } + + }