Skip to content

Reader events

joseph edited this page Jul 3, 2012 · 5 revisions

The Monocle Reader fires custom events when interesting things happen. Here's a list of event names. Each custom event may have event data in the m property of the event object.

  • monocle:incompatible — This browser is not compatible with Monocle. You can preventDefault() this event and handle it your own way.

  • monocle:initializing — The browser is compatible, so the Reader is initialising. Still too early to add controls.

  • monocle:loading — All Reader elements have been created, we're now loading the first components. Can add controls.

  • monocle:styles — The required styles have been applied to all Reader elements (except inside iframes). Called during initialisation.

  • monocle:frameprimed — One of the component iframes has been loaded with about:blank, or whatever the primeURL is. It's ready to load actual content now.

  • monocle:loaded — The first components have been loaded, and Monocle is ready.

  • monocle:notfound — Could not find the component specified in the locus.

  • monocle:componentloading — We've asked for the component content from the book data object.

  • monocle:componentfailed — Something went wrong while fetching the component content from the book data object.

  • monocle:componentloaded — Component has been fetched successfully from the book data object.

  • monocle:componentchanging — We're about to apply this component to an iframe.

  • monocle:componentmodify — The content has loaded into the iframe, but it hasn't been styled. Good place to apply content styles.

  • monocle:componentchange — Content has been loaded, and styles applied, and the dimensions have been measured.

  • monocle:firstcomponentchange — special event for the first componentchange event for each iframe.

  • monocle:pagechange — A page change for the given locus is possible, and we are about to change the page. Good place to update page numbers.

  • monocle:boundarystart — Can't turn page, because we are at the start of the book.

  • monocle:boundaryend — Can't turn page, because we are at the end of the book.

  • monocle:turn — A page change (including animation) has been completed.

  • monocle:resizing — The window, orientation or containing div size is being changed.

  • monocole:resize — Window/orientation/div resizing has finished.

  • monocle:recalculating — Something (a resize? a new stylesheet?) has invalidated our precalculated component dimensions (ie, the number of pages in this chapter). Recalculation is underway.

  • monocle:recalculated — We have recalculated the component dimensions (and probably restored the current place to a new page number).

  • monocle:jumping — We are moving to a new location by some method other than sequential page turn — such as via Table of Contents, or internal link, or scrubber, etc.

  • monocle:jump — We've finished jumping.

  • monocle:stylesheetchanging — We are about to add/update/remove a component stylesheet, which apply to the internal iframe documents. This is different to applying the stylesheets on component change (which happens in componentmodify).

  • monocle:stylesheetchange — We have added/updated/removed a component stylesheet.

  • monocle:interactive:on — Called by the i-mode panels when the user invokes "marginal" mode so they can select text.

  • monocle:interactive:off — Called by the i-mode panels when the user invokes "three-pane" mode, where the panels cover the entire page.

  • monocle:controlhide — A control has been hidden.

  • monocle:controlshow — A control has been shown.

Clone this wiki locally