Documentation Home

Chrome Server API Overview

This page summarizes the objects and functions available to you in the Chrome Server scripting API. For full details of the templating API used to present the output of your scripts to the user, see the Chrome templating pages. For summaries of the capabilities of Chrome Server and how to get started see the Chrome Server introduction and getting started pages.

Page Lifecycle

The Chrome Server lifecycle is fairly simple - each incoming request triggers a set of six operations the last of which is a call to a function called display(). The user can over-ride the contents of the display function or leave its default behaviour in place.

  1. Request arrives
  2. Chrome objects/functions are created and placed in the global object (request, response, renderer, log, database, system, md5)
  3. Default display() Function is created and placed in the global object
  4. Global Script is evaluated
  5. Page Script is evaluated
  6. display() function is invoked

Chrome objects and types

These are the standard objects that are available from the global namespace to all Chrome Server scripts.

display

Calls the display() function of the renderer object

renderer

Types: path: string

request

Properties

All these properties are of string type and can also be accessed with corresponding get methods:

Functions

Types: name: string

response

Types: name: string, value: string, type: string, text: string

log

Types: message: string

database

Types: name: string, key: string, value: string, number, boolean

DatabaseKeyList

Calling the reverse() method twice returns the original DatabaseKeyList instance, not a new one!

Chrome functions

These are the standard functions that are available from the global namespace to all Chrome Server scripts.

Types: library: string, revision: number, content: string, salt: string

Chrome system libraries

System libraries enhance the scripting environment with additional objects and functions. New libraries will in general be added to Chrome Server but not removed. Where new functionality obsoletes or breaks old functionality the older library will be supplmented by a new version - the old version will still be available for use by legacy scripts.

Adds the trim() prototype method to string

Installs the JSON object.

Types: object: object, text: string