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

Skip to first unread message

Diego de la Hera

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!


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
0 new messages