Page MenuHomePhabricator

Notification objects are hard to access
Closed, ResolvedPublic

Description

It would be nice to let mw.notify() return the notification object it creates, so that our code can easily update its contents, pause it, etc.


Version: 1.23.0
Severity: enhancement

Details

Reference
bz57400

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:34 AM
bzimport set Reference to bz57400.

As of Icd7fd1ac (included in MW 1.22) the .close() method is exposed; other methods are not, though. That patch originally aimed to expose the entire object, but Krinkle suggested not to do that.

I'm using one with autoHide:false to report on progress while a brief operation is ongoing. To do this I'm adding a click() handler to the notification's div, so I can abort the operation if the user closes the notification. I guess it would also meet my needs if I could give an onclose() callback to mw.notify().

But I'd say expose the object. It would let developers do more creative things with the notifications.

I guess this bug just needs a decision from Krinkle then?

I say let's consider what we have here a consensus and just do it. :D

Change 110667 had a related patch set uploaded by Bartosz Dziewoński:
mediawiki.notification: Return the Notification object from .notify calls

https://gerrit.wikimedia.org/r/110667

Change 110667 merged by jenkins-bot:
mediawiki.notification: Return the Notification object from .notify calls

https://gerrit.wikimedia.org/r/110667