mobx#action TypeScript Examples

The following examples show how to use mobx#action. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StereoParameters.ts    From binaural-meet with GNU General Public License v3.0 6 votes vote down vote up
// make all participants hearable
  @action
  setBroadcast(bcast:boolean) {
    //  ---------------------------------------------------
    //  Do not hear all even when broadcast
    bcast = false

    this.refDistance = bcast ? BROADCAST_DISTANCE - 1 : this.refDistanceNormal
    //  console.log(`setBroadcast is called bcast=${bcast}  distance=${this.refDistanceNormal}`)
  }
Example #2
Source File: AuthController.ts    From clarity with Apache License 2.0 6 votes vote down vote up
@action.bound
  async createNewVault(password: string): Promise<void> {
    if (this.getEncryptedVault()) {
      throw new Error('There is a vault already');
    }
    const hash = this.hash(password);
    this.passwordHash = hash;
    await this.clearAccount();
    await this.persistVault();
    this.appState.hasCreatedVault = true;
    this.appState.isUnlocked = true;
  }
Example #3
Source File: ClientsStore.ts    From eth2stats-dashboard with MIT License 6 votes vote down vote up
@action.bound
    fetch() {
        return new Promise((resolve, reject) => {
            axios.get(this.main.getNetworkConfig()!.HTTP_API + "/clients").then((response) => {
                runInAction(() => {
                    this.updateList(response.data.data);
                    this.clientsLoading = false;
                    resolve();
                });
            }).catch((err) => {
                reject(err);
            });
        });
    }
Example #4
Source File: DaoService.ts    From dxvote with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(context: RootContext) {
    this.context = context;

    makeObservable(this, {
      createProposal: action,
      vote: action,
      approveVotingMachineToken: action,
      stake: action,
      execute: action,
      redeem: action,
    });
  }
Example #5
Source File: store.ts    From generator-earth with MIT License 6 votes vote down vote up
/**
     * 设置二级state
     */
    @action.bound
    setSubState(key1, key2, value) {
        const {commonTableStore:store} = this.rootStore;

        store[key1][key2] = value;
    }
Example #6
Source File: FormWizardStore.ts    From jmix-frontend with Apache License 2.0 6 votes vote down vote up
constructor(config: FormWizardStepConfig) {
        makeObservable(this, {
            status: observable,
            setStatus: action

        })
        this.fieldNames = config.fieldNames;
        this.name = config.name;
    }
Example #7
Source File: Content.tsx    From hive with MIT License 6 votes vote down vote up
@action
    removeOneSecond = () => {
        const { onTime } = this.props;

        this.time -= 1;
        if (this.time <= 0) {
            this.time = 0;
            if (this.timeout) {
                clearInterval(this.timeout);
            }
            onTime();
        }
    };