Listen to select events on JSX-ified Zotero pane's item tree

34 views
Skip to first unread message

Diego de la Hera

unread,
Sep 9, 2021, 9:24:38 AM9/9/21
to zotero-dev
Hi, all.

The Cita plugin adds a "Citations" tab to the item pane. To refresh its contents when selection changes in the item tree, it listens to 'select' events on 'zotero-items-tree'. However, since JSX-ification of the Zotero pane, this doesn't seem to be working anymore.

To solve this, I'm using `ZoteroPane.itemsView.onSelect.addListener` upon plugin load, after `Zotero.uiReadyPromise` has resolved.

I would like to remove the listener upon plugin unload. However, the listener object returned by createEventBinding doesn't provide a `removeListener` method. The only way available seems to be `<listenerObject>._events[event].listeners.delete(listener)`, but I guess the `_events` property is not meant to be changed manually.

Is there an alternative? Would you consider adding a `removeListener` method to the listener object returned by createEventBinding?

Thank you!

Diego

adoma...@gmail.com

unread,
Oct 5, 2021, 9:18:02 AM10/5/21
to zotero-dev
Sorry for the delay in the response. I've pushed a commit that adds a `removeListener()` method. It will be available in the next release of the Beta.
Reply all
Reply to author
Forward
0 new messages