LA1TV / Hyperdeck-JS-Lib

A javascript library for communication with the Blackmagic Hyperdeck.
MIT License
26 stars 8 forks source link

hyperdeck.format fix context scoping #57

Closed TomKaltz closed 6 years ago

TomKaltz commented 6 years ago

this inside a then was not scoped correctly.

tjenkinson commented 6 years ago

hey @TomKaltz thanks for the PR!

Please could you change it to

  this.format = function(format){
    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));
  };

instead? We don't support es6 anywhere else in the code.

tjenkinson commented 6 years ago

thanks published as 1.4.1