zotero / zotero

Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.

Home Page:https://www.zotero.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make notifier more strict and better documented

adomasven opened this issue · comments

The Zotero.Notifier is an excellent part of Zotero code infrastructure and the benefits of pub-sub systems are known and many. However I am often rather worried about working with it, especially expanding notification topics, because of loose documentation and unenforced types of events allowed. Going forward having a robust pub-sub system is going to be very important, especially once we switch to Electron and it would be good to make the current system more explicit on the types of topics and events that are available.

Something like at least this kind of type checking for both topics and events would be a good start. A more ideal solution would be moving the event specs outside into a JSON file that specifies which events are available for individual topics, such that event subscribers don't have to sift through the codebase to figure it out.

I am willing to submit a PR.