Skip to content

Commit

Permalink
Merge pull request #46 from kwhitley/v1.x
Browse files Browse the repository at this point in the history
V1.x
  • Loading branch information
kwhitley authored Jan 7, 2024
2 parents 06e1cb7 + 4323bbd commit efebd09
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/itty-durable.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ export const createDurable = (options = {}) => {

return class IttyDurable {
constructor(state = {}, env = {}) {
this.state = {
this.state = state

Object.assign(this.state, {
defaultState: undefined,
initialized: false,
router: Router(),
env,
...env,
...state,
}

// embed bindings into this.env
Expand Down Expand Up @@ -149,6 +150,10 @@ export const createDurable = (options = {}) => {

return persistable
}

async block(callback) {
return await this.state.blockConcurrencyWhile(callback)
}

async loadFromStorage() {
if (!this.state.initialized) {
Expand Down

0 comments on commit efebd09

Please sign in to comment.