map.apps Bundle APIs 4.20.0
    Preparing search index...

    Function ifTargetNotEqualsAlmost

    • Builds function which executes a given callback only if value is not 'almost' equal to the target value. The created function will have a "else" method, which can be used to bind default values.

      Parameters

      • eps: number

        epsilon number which defines the allowed difference to the target value.

      • Optionalcallback: ConvertFunction

        to execute if value is not almost equal.

      Returns TransformerWithElse

      transformer function.

      let a = new Clazz({prop: 2});
      let b = new Clazz();
      Binding.for(a, b)
      .syncToRight("prop",
      ifTargetNotEqualsAlmost(0.001)
      ).enable().syncToRightNow();
      a.prop = 2.0002; // -> b.prop === 2, detects no change