Merge pull request #9 from lbryio/lbry-version

Added version call to lbry.js
This commit is contained in:
akinwale 2018-04-24 16:15:51 +01:00 committed by GitHub
commit 06cfc1c88c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

11
dist/bundle.js vendored
View file

@ -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) {

View file

@ -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);