Please turn on JavaScript. To find out how to do this visit the WebWise JavaScript guide.

Simple assert methods.

This module is only included in debug versions of Glow.

Methods

assert

Checks that a condition is true.

Synopsis

glow.debug.assert(condition, message);

Parameters

condition
Type
Boolean

The condition to check

message
Type
String

The error message to use if the condition is false.

[Optional further description after newline]

Example

// check that the first argument to a function was a glow.dom.NodeList
glow.debug.assert(aruments[0] instanceof glow.dom.NodeList, 'nodeList must be a glow.dom.NodeList');
assertParameterObject

Checks that a parameter object contains certain parameters.

Synopsis

glow.debug.assertParameterObject(parameters, required, optional, message);

Parameters

parameters
Type
Object

The parameter object to check.

required
Type
Array

The names of parameters that must be present.

optional
Type
Array

The names of parameters that can be present.

message
Type
String

The error message to use (with more detailed information appended).

Example

// check that name is passed, and possibly email
glow.debug.assertParameterObect(arguments[0], ['name'], ['email'], 'invalid parameters to addUser');
Documentation generated by JsDoc Toolkit 2.1.0 on Mon Jul 06 2009 11:46:05 GMT+0100 (BST)

BBC © 2014 The BBC is not responsible for the content of external sites. Read more.

This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.