| 35 | ) {} |
| 36 | |
| 37 | handle(event: PermissionEvent) { |
| 38 | const permission = event.properties |
| 39 | const previous = this.queues.get(permission.sessionID) ?? Promise.resolve() |
| 40 | const next = previous |
| 41 | .then(() => this.process(event)) |
| 42 | .catch(() => {}) |
| 43 | .finally(() => { |
| 44 | if (this.queues.get(permission.sessionID) === next) { |
| 45 | this.queues.delete(permission.sessionID) |
| 46 | } |
| 47 | }) |
| 48 | this.queues.set(permission.sessionID, next) |
| 49 | } |
| 50 | |
| 51 | private async process(event: PermissionEvent) { |
| 52 | const permission = event.properties |