Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Utils

Obligatory utility methods for games.

constructor

Hierarchy

  • Utils

Index

Methods

Static getObjectSize

  • getObjectSize(obj: Object): number
  • Returns the number of elements in an object.

    Parameters

    • obj: Object

      The object.

    Returns number

    The number of elements in the object.

Static getRequestParam

  • getRequestParam(param: string): string
  • Returns the value of a request parameter.

    Parameters

    • param: string

      The name of the request parameter.

    Returns string

    The value of the request parameter, or null if it was not specified.

Static hitch

  • hitch(scope: any, func: Function): Function
  • Equivlaent to dojo/_base/hitch, returns a function in a specific scope.

    Parameters

    • scope: any

      The scope to run the function in (e.g. the value of "this").

    • func: Function

      The function.

    Returns Function

    A function that does the same thing as 'func', but in the specified scope.

Static initConsole

  • initConsole(): void
  • Defines console functions for IE9 and other braindead browsers.

    Returns void

Static mixin

  • mixin(source: any, target: any): void
  • Adds the properties of one element into another.

    Parameters

    • source: any

      The object with properties to mix into another object.

    • target: any

      The object that will receive the new properties.

    Returns void

Static randomInt

  • randomInt(min: number, max: number): number
  • randomInt(max: number): number
  • Returns a random integer between min (inclusive) and max (exclusive). If max is omitted, the single parameter is treated as the maximum value, and an integer is returned in the range 0 - value.

    Parameters

    • min: number
    • max: number

      The maximum possible value, exclusive.

    Returns number

    The random integer value.

  • Parameters

    • max: number

    Returns number

Static timestamp

  • timestamp(): number
  • Returns a time in milliseconds. This will be high resolution, if possible. This method should be used to implement constructs like delays.

    Returns number

    A time, in milliseconds.

Generated using TypeDoc