@updatedev/js
Version:
Update JavaScript SDK
24 lines • 573 B
JavaScript
class StorageClient {
constructor(getAll, setAll) {
this.getAll = getAll;
this.setAll = setAll;
this.getAll = getAll;
this.setAll = setAll;
}
async set(name, value, options) {
if (this.setAll == null) return;
await this.setAll([{ name, value, options }]);
}
async get(name) {
var _a;
const cookies = await this.getAll();
if (!cookies) {
return void 0;
}
return (_a = cookies.find((cookie) => cookie.name === name)) == null ? void 0 : _a.value;
}
}
export {
StorageClient
};
//# sourceMappingURL=storage.js.map