Skip to content

Commit

Permalink
Log a deprecation warning to warn about uses of Instance::onEvent
Browse files Browse the repository at this point in the history
Signed-off-by: Seb Julliand <[email protected]>
  • Loading branch information
sebjulliand committed Jul 29, 2024
1 parent 464e41a commit 53edeff
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/api/Instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export default class Instance {
*/
onEvent(event: IBMiEvent, func: Function): void {
this.getSubscribers(event).set(`deprecated - ${func.name || "unknown"}_${this.deprecationCount++}`, { func });
console.warn("[Code for IBM i] Deprecation warning: you are using Instance::onEvent which is deprecated and will be removed in v3.0.0. Please use Instance::subscribe instead.");
}

fire(event: IBMiEvent) {
Expand Down

0 comments on commit 53edeff

Please sign in to comment.