How to listen for toggling reading view?

I’m developing a plugin and I want to listen a event that the user switches to reading view or editing view, but I haven’t found an API for that.

Is there any solution or maybe just I missed something? Thanks for any help.

You can listen to workspace.on('layout-change', ...) although this event is also triggered for other types of layout changes.


The current mode is saved as the data-mode attribute of view.containerEl. So one can listen to the attribution mutation of this element.