Sign in or register
for additional privileges

Scalar 1 User’s Guide

You appear to be using an older verion of Internet Explorer. For the best experience please upgrade your IE version or switch to a another web browser.

ScalarModel

The ScalarModel class stores local Scalar API data. Once the Scalar API JavaScript library is loaded, the ScalarModel object is available through the “model” property of the globally-scoped variable “scalarapi”.

Methods


MethodTypeDescription
getBookNode()ScalarNode
Returns the node representing the current book, if it can be found.
getMainMenuNode()ScalarNode
Returns the node representing the current book’s main menu, if it can be found.
getNodes( sort:string )arrayReturns an array all nodes for which data has been loaded, sorted according to the specified criteria (currently the only option is “alphabetical”).
getNodesWithProperty( property:string, value:*, sort:string )array

Returns an array of all nodes for which data has been loaded, that match the specified criteria.

Method parameters:
  • property - The property to be matched. Any named property can be used, plus a few special options:

    • “scalarType” - Test for nodes with matching types like “page,” “media,” “annotation,” “tag”, etc.

    • “dominantScalarType” - Test for the node’s most specialized type—for example: every path is also a page, but with this test all paths will only match the “path” type and not the “page” type.

    • “mediaSource” - Test for media nodes whose whose source files match the named types specified in scalarapi.mediaSources, such as “JPEG”, “WAV”, etc.
    • “contentType” - Test for media nodes whose source files match the named content types specified in scalarapi.mediaSources, such as “audio”, “video”, etc.

  • value - The value to be matched.

  • sort - Sort method to be applied to the results (currently the only option is “alphabetical”).
Comment on this page
 

Discussion of "ScalarModel"

Add your voice to this discussion.

Checking your signed in status ...

Previous page on path Scalar API JavaScript library reference, page 2 of 5 Next page on path