mirror of
https://github.com/embarklabs/EmbarkJS.git
synced 2025-01-09 12:05:51 +00:00
Make provider Name part of API
This commit is contained in:
parent
fa0e8e3770
commit
6b93af0b75
@ -6,16 +6,17 @@ Messages.registerProvider = function (providerName, obj) {
|
|||||||
this.Providers[providerName] = obj;
|
this.Providers[providerName] = obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
Messages.setProvider = function (provider, options) {
|
Messages.setProvider = function (providerName, options) {
|
||||||
let providerObj = this.Providers[provider];
|
let provider = this.Providers[providerName];
|
||||||
|
|
||||||
if (!providerObj) {
|
if (!provider) {
|
||||||
throw new Error('Unknown messages provider');
|
throw new Error('Unknown messages provider');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentMessages = providerObj;
|
this.currentMessagesName = providerName;
|
||||||
|
this.currentMessages = provider;
|
||||||
|
|
||||||
return providerObj.setProvider(options);
|
return provider.setProvider(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
Messages.isAvailable = function () {
|
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.Providers[providerName] = obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
Names.setProvider = function (provider, options) {
|
Names.setProvider = function (providerName, options) {
|
||||||
let providerObj = this.Providers[provider];
|
let provider = this.Providers[providerName];
|
||||||
|
|
||||||
if (!providerObj) {
|
if (!provider) {
|
||||||
throw new Error('Unknown name system provider');
|
throw new Error('Unknown name system provider');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentNameSystems = providerObj;
|
this.currentNameSystemsName = providerName;
|
||||||
|
this.currentNameSystems = provider;
|
||||||
|
|
||||||
return providerObj.setProvider(options);
|
return provider.setProvider(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
// resolve resolves a name into an identifier of some kind
|
// resolve resolves a name into an identifier of some kind
|
||||||
|
@ -51,16 +51,17 @@ Storage.registerProvider = function (providerName, obj) {
|
|||||||
this.Providers[providerName] = obj;
|
this.Providers[providerName] = obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
Storage.setProvider = function (provider, options) {
|
Storage.setProvider = function (providerName, options) {
|
||||||
let providerObj = this.Providers[provider];
|
let provider = this.Providers[providerName];
|
||||||
|
|
||||||
if (!providerObj) {
|
if (!provider) {
|
||||||
throw new Error('Unknown storage provider');
|
throw new Error('Unknown storage provider');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentStorage = providerObj;
|
this.currentStorageName = providerName;
|
||||||
|
this.currentStorage = provider;
|
||||||
|
|
||||||
return providerObj.setProvider(options);
|
return provider.setProvider(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
Storage.isAvailable = function () {
|
Storage.isAvailable = function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user