mirror of
https://github.com/tutao/tutanota.git
synced 2025-12-08 06:09:50 +00:00
imported new tutanota client
This commit is contained in:
parent
5453141be1
commit
ea1c1ef1c7
751 changed files with 122171 additions and 79 deletions
30
src/api/main/EntityEventController.js
Normal file
30
src/api/main/EntityEventController.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// @flow
|
||||
import {remove} from "../common/utils/ArrayUtils"
|
||||
import {TypeRef} from "../common/EntityFunctions"
|
||||
import {assertMainOrNode} from "../Env"
|
||||
|
||||
assertMainOrNode()
|
||||
|
||||
export class EntityEventController {
|
||||
|
||||
_listeners: Array<EntityEventReceived>;
|
||||
|
||||
constructor() {
|
||||
this._listeners = []
|
||||
}
|
||||
|
||||
addListener(listener: EntityEventReceived) {
|
||||
this._listeners.push(listener)
|
||||
}
|
||||
|
||||
removeListener(listener: EntityEventReceived) {
|
||||
remove(this._listeners, listener)
|
||||
}
|
||||
|
||||
notificationReceived(entityUpdate: EntityUpdate) {
|
||||
let typeRef = new TypeRef(entityUpdate.application, entityUpdate.type)
|
||||
this._listeners.forEach(listener => {
|
||||
listener(typeRef, entityUpdate.instanceListId, entityUpdate.instanceId, entityUpdate.operation);
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue