< documentation

API

options

hooks

platform

options

  • Envjs provides a number of basic configurable options which allow users to modify the default behavior the code base.

    Options, Hooks, and Platform functions are all set, or overridden via the same mechanism, using Envjs as a function whose argument as an object is used to effectively replace the default value.

    Options and Hooks are the end-users API, while Platform is the developers API for providing a bridge to another host language and/or javascript language.

    Of course the nature of Javascript as a language make it easy to extend or replace the Envjs API including the core browser API's like DOM, HTML, XHR, etc. We are also encouraging developer to package their adaptations as simple plugins that can be shared with the community

    please provide example 0 here
  • logLevel


    Sets the verbosity of the log messages produced by Envjs Allowed values are NONE, ERROR, WARN, INFO, and DEBUG

    Defaults
    logger level
    root 'ERROR'
    please provide example 0 here
    please provide example 1 here
  • os_name


    Sets value which is returned as part of window.navigator.appVersion In Firefox on OSX this is '5.0 (Macintosh; en-US)'

    default (rhino): java.lang.System.getProperty('os.name')

    please provide example 1 here
    please provide example 1 here

hooks

  • Hooks allow users of Envjs to extend the usual behavior at well known points, or to subscribe to internal events that a browser would not normally expose.

    These are very useful, for example, to allow Envjs users to run existing HTML files unmodified, while still being able to provide additional information to the console, or to store state regarding the HTML applications processes.

    please provide example 1 here
    please provide example 1 here

platform

  • Platform functions are required to be implemented by authors who wish to run Envjs on additional javascript engines. Currenlty only rhino is supported though we hope to support additional engines in the future.

    These functions are also available to the Envjs users as utilities, for example, to write out the resulting dom, after manipulation by javascript, to a local file. Also the default implementations may be easily overridden to suit the users particular needs.

    please provide example 0 here
  • log


    Allows the platform to define a method to provide standard output. Expects a string argument and returns nothing.

    env.rhino.js provides an implementation that uses the global Rhino print function. Users that prefer a different outputformat or want to write logs to a file can override this function.

    please provide example 1 here