Merge pull request #9 from lbryio/lbry-version
Added version call to lbry.js
This commit is contained in:
commit
06cfc1c88c
2 changed files with 24 additions and 3 deletions
11
dist/bundle.js
vendored
11
dist/bundle.js
vendored
|
@ -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) {
|
||||
|
|
16
src/lbry.js
16
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);
|
||||
|
|
Loading…
Reference in a new issue