From 22bf8f7d5e959bdf7b2ae3af9c22643075a66a6c Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 26 Jul 2018 15:13:11 -0400 Subject: [PATCH 1/4] add registerSubDomain function --- src/names.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/names.js b/src/names.js index baad2ed..18f1031 100644 --- a/src/names.js +++ b/src/names.js @@ -1,6 +1,7 @@ let Names = {}; Names.Providers = {}; +Names.noProviderError = 'Name system provider not set; e.g EmbarkJS.Names.setProvider("ens")'; Names.registerProvider = function (providerName, obj) { Names.Providers[providerName] = obj; @@ -21,7 +22,7 @@ Names.setProvider = function (provider, options) { // resolve resolves a name into an identifier of some kind Names.resolve = function (name) { if (!this.currentNameSystems) { - throw new Error('Name system provider not set; e.g EmbarkJS.Names.setProvider("ens")'); + throw new Error(this.noProviderError); } return this.currentNameSystems.resolve(name); }; @@ -29,7 +30,7 @@ Names.resolve = function (name) { // the reverse of resolve, resolves using an identifier to get to a name Names.lookup = function (identifier) { if (!this.currentNameSystems) { - throw new Error('Name system provider not set; e.g EmbarkJS.Names.setProvider("ens")'); + throw new Error(this.noProviderError); } return this.currentNameSystems.lookup(identifier); }; @@ -38,15 +39,11 @@ Names.isAvailable = function () { return this.currentNameSystems.isAvailable(); }; -// To Implement - - -// register a name -Names.register = function(name, options) { +Names.registerSubDomain = function(name, address, callback) { if (!this.currentNameSystems) { - throw new Error('Name system provider not set; e.g EmbarkJS.Names.setProvider("ens")'); + throw new Error(this.noProviderError); } - return this.currentNameSystems.register(name, options); + return this.currentNameSystems.registerSubDomain(name, address, callback); }; export default Names; From 3264adf87776e198898996d38ac4eb366733c74d Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 26 Jul 2018 15:13:28 -0400 Subject: [PATCH 2/4] add cross-env to enable env var set for windows --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 61ce838..d91bff4 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,10 @@ ], "scripts": { "babel": "npm run babel:browser && npm run babel:node", - "babel:browser": "BABEL_ENV=browser babel --out-dir dist/browser src", - "babel:node": "BABEL_ENV=node babel --out-dir dist src", + "babel:browser": "cross-env BABEL_ENV=browser babel --out-dir dist/browser src", + "babel:node": "cross-env BABEL_ENV=node babel --out-dir dist src", "build": "npm run clean && npm run babel && npm run webpack", - "clean": "rimraf dist embark.min.js embarkjs-*.tgz package", + "clean": "cross-env rimraf dist embark.min.js embarkjs-*.tgz package", "http-server": "http-server", "prepare": "npm run build", "test": "echo \"Error: no test specified\" && exit 1", @@ -57,6 +57,7 @@ "@babel/preset-env": "7.0.0-beta.54", "ajv": "6.5.2", "babel-loader": "8.0.0-beta.4", + "cross-env": "5.2.0", "http-server": "0.11.1", "rimraf": "2.6.2", "webpack": "4.16.1", From 7a6aa21596a4d5b65ba49ae7554b644e2ff9657f Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 27 Jul 2018 13:02:50 -0400 Subject: [PATCH 3/4] add call backs --- src/names.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/names.js b/src/names.js index 18f1031..9d95abc 100644 --- a/src/names.js +++ b/src/names.js @@ -20,19 +20,19 @@ Names.setProvider = function (provider, options) { }; // resolve resolves a name into an identifier of some kind -Names.resolve = function (name) { +Names.resolve = function (name, callback) { if (!this.currentNameSystems) { throw new Error(this.noProviderError); } - return this.currentNameSystems.resolve(name); + return this.currentNameSystems.resolve(name, callback); }; // the reverse of resolve, resolves using an identifier to get to a name -Names.lookup = function (identifier) { +Names.lookup = function (identifier, callback) { if (!this.currentNameSystems) { throw new Error(this.noProviderError); } - return this.currentNameSystems.lookup(identifier); + return this.currentNameSystems.lookup(identifier, callback); }; Names.isAvailable = function () { From 5766d0f914d6000c71bb2f35fa4db1716775b559 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 27 Jul 2018 13:15:04 -0400 Subject: [PATCH 4/4] remove cross-env on rimraf --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d91bff4..9d9feeb 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "babel:browser": "cross-env BABEL_ENV=browser babel --out-dir dist/browser src", "babel:node": "cross-env BABEL_ENV=node babel --out-dir dist src", "build": "npm run clean && npm run babel && npm run webpack", - "clean": "cross-env rimraf dist embark.min.js embarkjs-*.tgz package", + "clean": "rimraf dist embark.min.js embarkjs-*.tgz package", "http-server": "http-server", "prepare": "npm run build", "test": "echo \"Error: no test specified\" && exit 1",