Merge pull request #14 from embark-framework/feature/add-provider-name
Make provider Name part of API
This commit is contained in:
commit
5f5557b87d
|
@ -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 () {
|
||||
|
|
11
src/names.js
11
src/names.js
|
@ -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
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Reference in New Issue