www.webOShelp.net

Get the latest on:webOS Developers' RSS FeedwebOS Facebook page webOS Twitter Feed

Home Resources API Reference Mojo.assertDefined(value, message, messageProperties)

Mojo.assertDefined(value, message, messageProperties)

Writes an error to the log if value evaluates to undefined.  Returns String containing the error message written to the log.

Parameter Type Description
value Object Value that must not evaluate to undefined.
message String Custom message to use if the assertion fails. Message will be run through template evaluation against messageProperties so you can include details of the assertion failure in the message.
messageProperties Object Object containing values to use with template evaluation.

Example usage:

Mojo.Event.listen=function listen(target,type,handlerFunction,useCapture){
  Mojo.assertDefined(target,"Mojo.Event.listen: 'target' parameter must be defined.");
  Mojo.assertString(type,"Mojo.Event.listen: 'type' parameter must be a string.");
  Mojo.assertFunction(handlerFunction,"Mojo.Event.listen: 'handlerFunction' parameter must be a function.");
  target.addEventListener(type,handlerFunction,!!useCapture);
};
 

0 Comments

    Add Comment


      • >:o
      • :-[
      • :'(
      • :-(
      • :-D
      • :-*
      • :-)
      • :P
      • :\
      • 8-)
      • ;-)