kwhitley / itty-durable

Cloudflare Durable Objects + Itty Router = shorter code
MIT License
244 stars 18 forks source link

Error: Durable Object state{this.constructor.name} does not contain method state{target}() #23

Open janat08 opened 2 years ago

janat08 commented 2 years ago
"itty-durable": "^1.0.0",
"itty-router": "^2.6.1",
export class State extends createDurable({autoPersist: false}) {
  constructor(...args) {
    super(...args)
    this.created = false
  }
  created(o) {
    this.created = true
    return this.created
  }
}
const STDO = proxyDurable(STATE)
  const obj = STDO.get(`state-${escaped}`)
  log('obj', obj, obj.created, await obj.STATE())
  log('res', await obj.created().then(x=>x.json()))
  console.log('state1', await STDO.get(`state-${escaped}`).toJSON().then(x=>x.json()))