Options
All
  • Public
  • Public/Protected
  • All
Menu

simscript

Index

Functions

assert

  • assert(condition: boolean, msg: string | Function): void
  • Throws an Exception if a condition is false.

    Parameters

    • condition: boolean

      Boolean value representing the condition to test.

    • msg: string | Function

      Message of the Exception thrown if the condition is false. This parameter can be a string or a function that returns a string.

    Returns void

bind

  • bind(id: string, initialValue: any, onInput: Function, suffix?: string, decimals?: number): void
  • Binds an input element to a variable (parameter).

    Parameters

    • id: string

      Id of the input element to bind.

    • initialValue: any

      Initial value applied to the input element.

    • onInput: Function

      Function called when the input value changes.

    • suffix: string = ''

      String appended to the span element after input range elements.

    • Optional decimals: number

      Number of decimal places to show for numeric values.

    Returns void

clamp

  • clamp(value: number, min: number | null, max: number | null): number
  • Clamps a value to a given range.

    Parameters

    • value: number

      Value to clamp.

    • min: number | null

      Minimum allowed value, or null of there is no lower bound.

    • max: number | null

      Maximum allowed value, or null of there is no upper bound.

    Returns number

    The clamped value (value >= min && value <= max).

format

  • format(value: number, decimals?: number): string
  • Formats a number using the current culture.

    Parameters

    • value: number

      Number to be formatted.

    • decimals: number = 2

      Number of decimals to display.

    Returns string

    A string containing the representation of the given number.

getElement

  • getElement(selector: any): Element
  • Gets an HTML element from a query selector.

    Parameters

    • selector: any

      An HTML element or a query selector string, or a jQuery object.

    Returns Element

isNumber

  • isNumber(val: any): boolean
  • Checks whether a value is a number.

    Parameters

    • val: any

      Value to check.

    Returns boolean

    True if the value is a number.

setOptions

  • setOptions(obj: any, options: any): void
  • Applies a group of property values and event handlers to an object.

    Parameters

    • obj: any

      Object that contains the properties and events.

    • options: any

      Object that contains the property values and event handlers to apply.

    Returns void

Generated using TypeDoc