AtomOnce will execute given method only once and it will prevent recursive calls. This is important when you want to update source and destination and prevent recursive calls.

example

       private valueOnce: AtomOnce = new AtomOnce();

       private onValueChanged(): void {
           valueOnce.run(()=> {
               this.value = compute(this.target);
           });
       }

       private onTargetChanged(): void {
           valueOnce.run(() => {
               this.target = computeInverse(this.value);
           });
       }

### Hierarchy

- AtomOnce

## Index

### Methods

- run

## Methods

### run

- run(f: function): void

- - Defined in src/core/AtomOnce.ts:40

  AtomOnce will execute given method only once and it will prevent recursive calls. This is important when you want to update source and destination and prevent recursive calls.

  example

         private valueOnce: AtomOnce = new AtomOnce();

         private onValueChanged(): void {
             valueOnce.run(()=> {
                 this.value = compute(this.target);
             });
         }

         private onTargetChanged(): void {
             valueOnce.run(() => {
                 this.target = computeInverse(this.value);
             });
         }

  #### Parameters

  - ##### f: function

    - - (): any

      - #### Returns any

  #### Returns void

Generated using TypeDoc