Utility functions for @unitybase/ub-pub module

Members

# isChrome : boolean static

# isGecko : boolean static

# isMac : boolean static

# isNodeJS : boolean static

It is either absence of userAgent (defaulted to the nodeJS string), or in recent versions of Node.js it is a string like `Node.js/24"

# isOpera : boolean static

# isReactNative : boolean static

# isSecureBrowser : boolean static

# isWebKit : boolean static

# LDS_KEYS static

localDataStorage keys used by @unitybase-ub-pub (in case of browser environment)

# userAgent : string static

Methods

# log (msg:  *) static

Log message to console (if console available)

Arguments:
  • msg: *

# logDebug (msg:  *) static

Log debug message to console. Since it binds to console, can also be used to debug Promise resolving in this way

Arguments:
  • msg: *
  
      UB.get('timeStamp').then(UB.logDebug);
  

# logError (msg:  *) static

Log error message to console (if console available)

Arguments:
  • msg: *

# logWarn (msg:  *) static

Log warning message to console (if console available)

Arguments:
  • msg: *

# parseUBError (errMsg:  string | object | Error | UBError, errCodeopt:  string, entityCodeopt:  string, detail:  string) → Object static

Parse error and translate message using i18n

Arguments:

# UBAbortError (messageopt:  string, detailopt:  string) inner

Quiet exception. Global error handler does not show this exception for user. Use it for silently reject promise

Arguments:

# UBError (message:  string, detailopt:  string, codeopt:  number, statusopt:  number) inner

UnityBase client-side exception. Such exceptions will not be showed as unknown error in UB.showErrorWindow

Arguments:
  • message: string

    Message can be either localized message or locale identifier - in this case UB#showErrorWindow translate message using UB#i18n

  • detail: string

    Error details

  • code: number

    Error code (for server-side errors)

  • status: number

    HTTP status code of response (if available)

  
      // in adminUI will show message box with text:
// "Record was locked by other user. It\'s read-only for you now"
throw new UB.UBError('lockedBy')