Skip to content

Commit

Permalink
update dist
Browse files Browse the repository at this point in the history
  • Loading branch information
rockwellll committed Jan 11, 2025
1 parent d63d30c commit 2fc3370
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/hellotext.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions lib/api/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototy
var id = 0;
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
var _success = /*#__PURE__*/_classPrivateFieldLooseKey("success");
/**
* Response class
* @class
* @classdesc Represents a response from the API
* @property {Boolean} succeeded
* @property {Object} data
*/
var Response = /*#__PURE__*/function () {
function Response(success, response) {
_classCallCheck(this, Response);
Expand All @@ -25,11 +32,21 @@ var Response = /*#__PURE__*/function () {
this.response = response;
_classPrivateFieldLooseBase(this, _success)[_success] = success;
}

/**
* Get the response data
* @returns {*}
*/
_createClass(Response, [{
key: "data",
get: function get() {
return this.response;
}

/**
* Parse the response as JSON
* @returns {Promise<*>}
*/
}, {
key: "json",
value: function () {
Expand All @@ -41,11 +58,20 @@ var Response = /*#__PURE__*/function () {
}
return json;
}()
/**
* Has the request failed?
* @returns {boolean}
*/
}, {
key: "failed",
get: function get() {
return _classPrivateFieldLooseBase(this, _success)[_success] === false;
}

/**
* Has the request succeeded?
* @returns {boolean}
*/
}, {
key: "succeeded",
get: function get() {
Expand Down
5 changes: 0 additions & 5 deletions lib/hellotext.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ var Hellotext = /*#__PURE__*/function () {
value: function () {
var _track = _asyncToGenerator(function* (action) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (_classPrivateFieldLooseBase(this, _query)[_query].inPreviewMode) {
return Promise.resolve().then(() => new _api.Response(true, {
received: true
}));
}
if (this.notInitialized) {
throw new _errors.NotInitializedError();
}
Expand Down

0 comments on commit 2fc3370

Please sign in to comment.