Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 10th, 2012  |  syntax: None  |  size: 0.79 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * Copyright 2002-2011 by Wingspan Technology, Inc.,
  3.  * All rights reserved.
  4.  */
  5. wspt.formatString = function(sFmt /*...*/)
  6. {
  7.     var sFmt = '' + sFmt; // support wspt.info(oObj); (no format string)
  8.     var sMsg = String.format.apply(null, arguments);
  9.     return sMsg;
  10. };
  11.  
  12. wspt.info = function(sFmt /*...*/)
  13. {
  14.     var sMsg = wspt.formatString.apply(null, arguments);
  15.     wspt.getLog().info(sMsg);
  16.     wspt.alertInfo(sMsg);
  17. };
  18.  
  19. wspt.assert = function(bTestVal, sFmt /*...*/)
  20. {
  21.     if(!bTestVal)
  22.     {
  23.         var args = Array.prototype.slice.call(arguments);
  24.         args.shift();
  25.         var sMsg = wspt.formatString.apply(null, args);
  26.                
  27.         // fail loudly in case the exception gets swallowed
  28.         wspt.getLog().error(sMsg);
  29.         wspt.alertError(sMsg);
  30.         throw Error(sMsg);     
  31.     }
  32. };