Skip to content

Commit

Permalink
fix: lonpolling
Browse files Browse the repository at this point in the history
  • Loading branch information
Tardo committed Nov 24, 2024
1 parent fe7d6b2 commit 0435589
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/js/page/odoo/longpolling.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ export default class Longpolling {
let has_listener = false;
if (typeof OdooVerMajor === 'number') {
if (OdooVerMajor <= 11) {
this.#getBusService().on('notification', this, this.onBusNotification);
// $FlowFixMe
this.#getBusService().on('notification', this, this.#onBusNotification.bind(this));
has_listener = true;
} else if (OdooVerMajor >= 16) {
this.#busServ('addEventListener', 'notification', this.onBusNotification);
// $FlowFixMe
this.#busServ('addEventListener', 'notification', this.#onBusNotification.bind(this));
has_listener = true;
}
}
if (!has_listener) {
this.#busServ('onNotification', this, (data: $ReadOnlyArray<OdooLongpollingItem>) =>
this.onBusNotification(data),
this.#onBusNotification(data),
);
}
}
Expand Down Expand Up @@ -109,7 +111,7 @@ export default class Longpolling {
}
return data;
}
onBusNotification(data: $ReadOnlyArray<OdooLongpollingItem>) {
#onBusNotification(data: $ReadOnlyArray<OdooLongpollingItem>) {
if (this.isVerbose()) {
this.#terminal.onBusNotification(this.#getNotificationsData(data));
}
Expand Down

0 comments on commit 0435589

Please sign in to comment.