Skip to content
This repository has been archived by the owner on Dec 12, 2018. It is now read-only.

Commit

Permalink
> modified: es6/util/property.js
Browse files Browse the repository at this point in the history
>	modified:   es6/zil/index.js
>	modified:   es6/zil/methodObjects.js
>	modified:   lib/util/property.js
>	modified:   lib/zil/index.js
>	modified:   lib/zil/methodObjects.js
>	modified:   package.json
  • Loading branch information
CapCap_ghostcorn authored and CapCap_ghostcorn committed Aug 28, 2018
1 parent f95db10 commit a3cab54
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion es6/util/property.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Property {

propertyBuilder = () => {
if (this.messanger !== null) {
return function get(callback) {
return (callback) => {
if (callback) {
return this.messanger.sendAsync({ method: this.getter }, callback)
}
Expand Down
6 changes: 6 additions & 0 deletions es6/zil/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ const mapPropertyToObjects = (main) => {
const zilProperty = new Property(data)
const zilName = data.name
zilProperty.setMessanger(main.messanger)
const asyncGetterName = (getName) => {
return `get${getName.charAt(0).toUpperCase()}${getName.slice(1)}`
}
const zilObject = {
get: zilProperty.propertyBuilder(),
enumerable: true
}
const newZilObject = {}
newZilObject[asyncGetterName(zilName)] = main.propertyBuilder()
Object.assign(main, newZilObject)
return Object.defineProperty(main, zilName, zilObject)
})
}
Expand Down
10 changes: 5 additions & 5 deletions es6/zil/methodObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ export default [
* getHashrate
* @params {}
*/
{
name: 'getHashrate',
call: 'GetHashrate',
params: {}
},
// {
// name: 'getHashrate',
// call: 'GetHashrate',
// params: {}
// },
/**
* isNodeMining
* @params {}
Expand Down
6 changes: 3 additions & 3 deletions lib/util/property.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ var Property = function Property(options) {

this.propertyBuilder = function () {
if (_this.messanger !== null) {
return function get(callback) {
return function (callback) {
if (callback) {
return this.messanger.sendAsync({ method: this.getter }, callback);
return _this.messanger.sendAsync({ method: _this.getter }, callback);
}
return this.messanger.send({ method: this.getter });
return _this.messanger.send({ method: _this.getter });
};
}
};
Expand Down
6 changes: 6 additions & 0 deletions lib/zil/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,16 @@ var mapPropertyToObjects = function mapPropertyToObjects(main) {
var zilProperty = new _property2.default(data);
var zilName = data.name;
zilProperty.setMessanger(main.messanger);
var asyncGetterName = function asyncGetterName(getName) {
return 'get' + getName.charAt(0).toUpperCase() + getName.slice(1);
};
var zilObject = {
get: zilProperty.propertyBuilder(),
enumerable: true
};
var newZilObject = {};
newZilObject[asyncGetterName(zilName)] = main.propertyBuilder();
(0, _assign2.default)(main, newZilObject);
return (0, _defineProperty2.default)(main, zilName, zilObject);
});
};
Expand Down
10 changes: 5 additions & 5 deletions lib/zil/methodObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ exports.default = [
* getHashrate
* @params {}
*/
{
name: 'getHashrate',
call: 'GetHashrate',
params: {}
},
// {
// name: 'getHashrate',
// call: 'GetHashrate',
// params: {}
// },
/**
* isNodeMining
* @params {}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webz.js",
"version": "0.0.21",
"version": "0.0.22",
"description": "Zilliqa Javascript Libraries",
"main": "lib/index.js",
"browser": "dist/Webz.browser.js",
Expand Down

0 comments on commit a3cab54

Please sign in to comment.