Skip to content

Commit

Permalink
feat(core): use define for private session properties
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Sep 13, 2020
1 parent bcd424a commit 356b9e4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/koishi-core/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ export class Session<U extends User.Field = never, G extends Group.Field = never
$uuid = Random.uuid()

private _delay?: number
private _queued = Promise.resolve()
private _hooks?: (() => void)[] = []
private _queued: Promise<void>
private _hooks: (() => void)[]

constructor(app: App, session: Partial<Session>) {
defineProperty(this, '$app', app)
defineProperty(this, '_queued', Promise.resolve())
defineProperty(this, '_hooks', [])
Object.assign(this, session)
}

Expand Down

0 comments on commit 356b9e4

Please sign in to comment.