Skip to content

Commit

Permalink
refactor factory to static class method
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpyle committed Apr 14, 2020
1 parent dc93871 commit e43aa23
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fs_burrito_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ class FSBurritoStore extends BurritoStore {
this._ingredientBuffer = new FSIngredientBuffer(this, sDir);
}

static async create(configJson, sDir) {

This comment has been minimized.

Copy link
@mvahowe

mvahowe Apr 14, 2020

Contributor

@ericpyle This looks perfect to me. Please make sure that we have the same signature for BurritoStore (probably with the "not overridden" error you'll see in other places in that file).

const fsBurritoStore = new FSBurritoStore(configJson);
await fsBurritoStore.initializeIngredientsAndMetadataStores(sDir);
return fsBurritoStore;
}

idServerName(idServerId, nameLang) {
const lang = nameLang || 'en';
const idDetails = this._metadataStore._idServers[idServerId];
Expand Down Expand Up @@ -98,9 +104,7 @@ class FSBurritoStore extends BurritoStore {
}

async function createFSBurritoStore(configJson, sDir) {
const fsBurritoStore = new FSBurritoStore(configJson);
await fsBurritoStore.initializeIngredientsAndMetadataStores(sDir);
return fsBurritoStore;
return FSBurritoStore.create(configJson, sDir);
}

export { FSBurritoStore, createFSBurritoStore };

0 comments on commit e43aa23

Please sign in to comment.