Merge pull request #14 from embark-framework/feature/add-provider-name

Make provider Name part of API
This commit is contained in:
Iuri Matias 2018-08-24 10:34:27 -04:00 committed by GitHub
commit 5f5557b87d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 15 deletions

View File

@ -6,16 +6,17 @@ Messages.registerProvider = function (providerName, obj) {
this.Providers[providerName] = obj;
};
Messages.setProvider = function (provider, options) {
let providerObj = this.Providers[provider];
Messages.setProvider = function (providerName, options) {
let provider = this.Providers[providerName];
if (!providerObj) {
if (!provider) {
throw new Error('Unknown messages provider');
}
this.currentMessages = providerObj;
this.currentProviderName = providerName;
this.currentMessages = provider;
return providerObj.setProvider(options);
return provider.setProvider(options);
};
Messages.isAvailable = function () {

View File

@ -7,16 +7,17 @@ Names.registerProvider = function (providerName, obj) {
Names.Providers[providerName] = obj;
};
Names.setProvider = function (provider, options) {
let providerObj = this.Providers[provider];
Names.setProvider = function (providerName, options) {
let provider = this.Providers[providerName];
if (!providerObj) {
if (!provider) {
throw new Error('Unknown name system provider');
}
this.currentNameSystems = providerObj;
this.currentProviderName = providerName;
this.currentNameSystems = provider;
return providerObj.setProvider(options);
return provider.setProvider(options);
};
// resolve resolves a name into an identifier of some kind

View File

@ -51,16 +51,17 @@ Storage.registerProvider = function (providerName, obj) {
this.Providers[providerName] = obj;
};
Storage.setProvider = function (provider, options) {
let providerObj = this.Providers[provider];
Storage.setProvider = function (providerName, options) {
let provider = this.Providers[providerName];
if (!providerObj) {
if (!provider) {
throw new Error('Unknown storage provider');
}
this.currentStorage = providerObj;
this.currentProviderName = providerName;
this.currentStorage = provider;
return providerObj.setProvider(options);
return provider.setProvider(options);
};
Storage.isAvailable = function () {