-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: store skus and last previewed in files storage
- Loading branch information
Showing
4 changed files
with
69 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class Files { | ||
internalStorage = {}; | ||
|
||
constructor(storageLatency = 500) { | ||
this.storageLatency = storageLatency; | ||
} | ||
|
||
async read(fileLocation) { | ||
return new Promise((resolve) => { | ||
setTimeout(() => resolve(this.internalStorage[fileLocation]), this.storageLatency); | ||
}); | ||
} | ||
|
||
async write(fileLocation, fileData) { | ||
return new Promise((resolve) => { | ||
setTimeout(() => resolve(this.internalStorage[fileLocation] = fileData), this.storageLatency); | ||
}); | ||
} | ||
} | ||
|
||
module.exports = Files; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters