Skip to content

[notify] Calling require("notify").hide() outside of an event handler crashes #4327

Description

@kidneyhex

Affected hardware version

Bangle 2

Your firmware version

2v29

The bug

When require("notify").hide() is called outside of an event handler, it throws an exception because "E.stopEventPropagation() called when not handling events".

I'm not sure if that's something to just ignore, or wrap in a try/catch, or what...

Recreate by running in REPL:

require("notify").show({ title: "Test", body: "Hello World" });
require("notify").hide();

Result:

>require("notify").hide();
Uncaught Error: E.stopEventPropagation() called when not handling events
    at hide (notify:9:222)
...gation&&E.stopEventPropagation();function anim(){pos+=4;if(pos>0){pos=...
                                 ^
    at REPL (:1:24)
require("notify").hide();

Workaround

Call it in a setTimeout:

require("notify").show({ title: "Test", body: "Hello World" });
setTimeout(() => require("notify").hide(), 1000);

Installed apps

No response

Author

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions