From bdf7639bb2a785795ed899063c55a6793cbc8edd Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sat, 21 Apr 2018 21:40:54 +0100 Subject: [PATCH] Added version call to lbry.js since proxy polyfill still doesn't work properly --- dist/bundle.js | 11 ++++++++++- src/lbry.js | 16 ++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index 3c23615..a7cab35 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -1773,13 +1773,22 @@ function apiCall(method /*: string*/, params /*: ?{}*/, resolve /*: Function*/, // core Lbry.status = function () { + var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return new Promise(function (resolve, reject) { - apiCall('status', {}, function (status) { + apiCall('status', params, function (status) { resolve(status); }, reject); }); }; +Lbry.version = function () { + return new Promise(function (resolve, reject) { + apiCall('version', {}, function (versionInfo) { + resolve(versionInfo); + }, reject); + }); +}; + Lbry.file_delete = function () { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return new Promise(function (resolve, reject) { diff --git a/src/lbry.js b/src/lbry.js index 1e1b783..947c4d5 100644 --- a/src/lbry.js +++ b/src/lbry.js @@ -50,11 +50,11 @@ function apiCall(method: string, params: ?{}, resolve: Function, reject: Functio } // core -Lbry.status = () => +Lbry.status = (params = {}) => new Promise((resolve, reject) => { apiCall( 'status', - {}, + params, status => { resolve(status); }, @@ -62,6 +62,18 @@ Lbry.status = () => ); }); +Lbry.version = () => + new Promise((resolve, reject) => { + apiCall( + 'version', + {}, + versionInfo => { + resolve(versionInfo); + }, + reject + ); + }); + Lbry.file_delete = (params = {}) => new Promise((resolve, reject) => { apiCall('file_delete', params, resolve, reject);