From 95c3cac62df61966b7f7f3f834f653e06cb3d34b Mon Sep 17 00:00:00 2001 From: Thomas Kaltz III Date: Mon, 11 Jun 2018 15:26:22 -0400 Subject: [PATCH 1/2] hyperdeck.format fix context scoping ```this``` inside a then was not scoped correctly. --- src/hyperdeck/hyperdeck.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hyperdeck/hyperdeck.js b/src/hyperdeck/hyperdeck.js index b40421e..30a4920 100644 --- a/src/hyperdeck/hyperdeck.js +++ b/src/hyperdeck/hyperdeck.js @@ -62,7 +62,7 @@ var Hyperdeck = function(config) { }; this.format = function(format){ - return this.makeRequest('format: prepare: ' + format).then(function(response){ + return this.makeRequest('format: prepare: ' + format).then((response)=>{ if (response.code !== 216 || response.text !== 'format ready' || !response.rawData) { throw new Error('Unexpected response.'); } From 19aef9fb2aa3613961aa82d20e25b75cce051222 Mon Sep 17 00:00:00 2001 From: Thomas Kaltz III Date: Mon, 11 Jun 2018 15:42:23 -0400 Subject: [PATCH 2/2] revert first fix then use regular bind --- src/hyperdeck/hyperdeck.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hyperdeck/hyperdeck.js b/src/hyperdeck/hyperdeck.js index 30a4920..5b5b636 100644 --- a/src/hyperdeck/hyperdeck.js +++ b/src/hyperdeck/hyperdeck.js @@ -62,13 +62,13 @@ var Hyperdeck = function(config) { }; this.format = function(format){ - return this.makeRequest('format: prepare: ' + format).then((response)=>{ + return this.makeRequest('format: prepare: ' + format).then(function(response){ if (response.code !== 216 || response.text !== 'format ready' || !response.rawData) { throw new Error('Unexpected response.'); } var token = response.rawData; return this.makeRequest('format: confirm: ' + token); - }); + }.bind(this)); }; };