BackgroundModule mahalo/change-detection/assign

This module exports the assign function that is responsible forchange detection.

Index

Functions

assign

  • assign(obj?: Object, key?: string | number, val?: any): any
  • The assign function triggers Mahalo's change detection. Howeverwhen writing your application in TypeScript you don't have to takecare of this yourself and won't need to use this function at all.

    Example

    In the following examples you can see different assignments an theircounterparts using assign.

    let foo = 0;let bar = 0;let baz = {x: 0};// Variable assignments are just wrapped++foo; // 1assign(++foo); // 2foo + (bar = 10); // bar 12foo + assign(bar = 10); // 12// Member assignments must be explicitfoo + baz.x++; // 2foo + assign(baz, 'x', baz.x + 1); // 3
    alias

    { assign } from mahalo

    Parameters
    • Optional obj: Object
    • Optional key: string | number
    • Optional val: any
    Returns any