Skip to content

Commit

Permalink
custom config & throw error in constructor (compat with older version…
Browse files Browse the repository at this point in the history
…s using options.label), also added options.name separate from label
  • Loading branch information
apratimankur committed Sep 6, 2023
1 parent 441e5f6 commit 02b7557
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ Muffin.WebRequestSdk = class {
constructor(options, lazyload = true) {
this.eventInterface = PostOffice.getOrCreateInterface("WebRequestSdk")
this.LEXICON = API_LEXICON;
this.label = options.label || "drona_store_sdk_client";
this.label = options.name || "sandbox_ws";
this.clientId = options.client_id || "";
this.token = options.token || "";
this.keepAliveTimeout = options.keepAliveTimeout || 60000;
this.uiVars = {
clock: {},
config: config[options.label]
this.uiVars.clock = {};

if(options.label) {
this.uiVars.config = config[options.label]
} else if(options.config){
this.uiVars.config = config[options.config]
} else {
throw Error("Neither Config-Label Nor Custom-Config Provided");
}

this._connection = null;
this.state = null;
this._connectionAlive = null;
Expand Down

0 comments on commit 02b7557

Please sign in to comment.