diff --git a/index.js b/index.js index 33edd85..dc4c89f 100644 --- a/index.js +++ b/index.js @@ -5,12 +5,9 @@ var actions = require('./actions'); var feedback = require('./feedback'); var presets = require('./presets'); var setup = require('./setup'); -var upgrades = require('./upgrades'); +var upgradeScripts= require('./upgrades'); var variables = require('./variables'); -var debug; -var log; - /** * Companion instance class for the Blackmagic SmartView/SmartScope Monitors. * @@ -45,10 +42,7 @@ class instance extends instance_skel { ...feedback, ...presets, ...variables, - ...upgrades - });; - - this.addUpgradeScripts(); + }); this.PRESETS_STATES = [ { action: 'bright', group: 'Brightness', label: 'Brightness\\n\\n@ ', choices: [{id: 0, label: '0'}, {id: 127, label: '127'}, {id: 255, label: '255'}] }, @@ -76,6 +70,10 @@ class instance extends instance_skel { this.actions(); // export actions } + static GetUpgradeScripts() { + return upgradeScripts + } + /** * Setup the actions. * @@ -279,9 +277,6 @@ class instance extends instance_skel { * @since 1.0.0 */ init() { - debug = this.debug; - log = this.log; - this.initVariables(); this.initFeedbacks(); this.initPresets(); diff --git a/package.json b/package.json index f0d407a..5a6d822 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bmd-smartview", - "version": "1.1.2", + "version": "1.1.3", "api_version": "1.0.0", "keywords": [ "Scope", diff --git a/upgrades.js b/upgrades.js index 2d62b8b..08e3715 100644 --- a/upgrades.js +++ b/upgrades.js @@ -1,40 +1,26 @@ -module.exports = { +module.exports = [ + // v1.1.0 (convert border col to val) + function (context, config, actions, feedbacks) { + var changed = false; - /** - * INTERNAL: add various upgrade scripts - * - * @access protected - * @since 1.1.0 - */ - addUpgradeScripts() { - - // v1.1.0 (convert border col to val) - this.addUpgradeScript((config, actions, releaseActions, feedbacks) => { - var changed = false; - - let upgradePass = function(action, changed) { - switch (action.action) { - case 'border': - if (action.options !== undefined && action.options.col !== undefined) { - action.options.val = action.options.col; - delete action.options.col; - changed = true; - } - break; - } - - return changed; + let upgradePass = function(action, changed) { + switch (action.action) { + case 'border': + if (action.options !== undefined && action.options.col !== undefined) { + action.options.val = action.options.col; + delete action.options.col; + changed = true; + } + break; } - for (let k in actions) { - changed = upgradePass(actions[k], changed); - } + return changed; + } - for (let k in releaseActions) { - changed = upgradePass(releaseActions[k], changed); - } + for (let k in actions) { + changed = upgradePass(actions[k], changed); + } - return changed; - }); + return changed; } -} \ No newline at end of file +] \ No newline at end of file