当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript object.set函数代码示例

本文整理汇总了TypeScript中@ember/object.set函数的典型用法代码示例。如果您正苦于以下问题:TypeScript set函数的具体用法?TypeScript set怎么用?TypeScript set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

  return function() {
    let currentValue = get(obj, prop);

    if (isPresent(values)) {
      let currentIdx = values.indexOf(currentValue);
      let nextIdx = nextIndex(get(values, 'length'), currentIdx);

      return set(obj, prop, values[nextIdx]);
    }

    return set(obj, prop, !currentValue);
  };
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:12,代码来源:toggle.ts

示例2: transitionTo

  /*
    @method transitionTo
    @private
    @param {String} name
  */
  transitionTo(name) {
    // POSSIBLE TODO: Remove this code and replace with
    // always having direct reference to state objects

    let pivotName = extractPivotName(name);
    let state = this.currentState;
    let transitionMapId = `${state.stateName}->${name}`;

    do {
      if (state.exit) {
        state.exit(this);
      }
      state = state.parentState;
    } while (!state[pivotName]);

    let setups;
    let enters;
    let i;
    let l;
    let map = TransitionChainMap[transitionMapId];

    if (map) {
      setups = map.setups;
      enters = map.enters;
      state = map.state;
    } else {
      setups = [];
      enters = [];

      let path = splitOnDot(name);

      for (i = 0, l = path.length; i < l; i++) {
        state = state[path[i]];

        if (state.enter) {
          enters.push(state);
        }
        if (state.setup) {
          setups.push(state);
        }
      }

      TransitionChainMap[transitionMapId] = { setups, enters, state };
    }

    for (i = 0, l = enters.length; i < l; i++) {
      enters[i].enter(this);
    }

    this.currentState = state;
    if (this.hasRecord) {
      set(this._record, 'currentState', state);
    }

    for (i = 0, l = setups.length; i < l; i++) {
      setups[i].setup(this);
    }

    this.updateRecordArrays();
  }
开发者ID:emberjs,项目名称:data,代码行数:65,代码来源:internal-model.ts

示例3: typeahead

  /**
   * Before we call onTypeahead, we cancel the last search task if available
   * and save the new one
   * @param text user typed text
   */
  typeahead(text: string): PromiseOrTask<Array<string>> {
    this.cancelTypeaheadTask();

    const typeaheadTask = this.onTypeahead(text);
    set(this, 'typeaheadTask', typeaheadTask);
    return typeaheadTask;
  }
开发者ID:alyiwang,项目名称:WhereHows,代码行数:12,代码来源:search-box.ts

示例4: get

const databaseInstance = (adapter: RealtimeDatabaseAdapter) => {
    let database = get(adapter, 'database');
    if (!database) {
        const app = get(adapter, 'firebaseApp');
        const databaseURL = get(adapter, 'databaseURL');
        database = app.database(databaseURL);
        set(adapter, 'database', database);
    }
    return database;
}
开发者ID:firebase,项目名称:emberfire,代码行数:10,代码来源:realtime-database.ts

示例5: onSubmit

  /**
   * When user intents to perform a search
   */
  onSubmit(): void {
    if (this.inputText && this.inputText.trim().length > 0) {
      // this will prevent search text from jitter,
      // since inputText may differ from text, PWS will try to restore
      // text since there was not a selection, but we will set text from the route
      // at a later point. That will cause the search box to show  for example:
      // => car // press enter
      // => somethingelse //after onSubmit
      // => car // route sets car

      set(this, 'text', this.inputText);
      this.onSearch(this.inputText);
      if (this.powerSelectApi) {
        this.powerSelectApi.actions.close();
      }
    }
  }
开发者ID:alyiwang,项目名称:WhereHows,代码行数:20,代码来源:search-box.ts

示例6: get

const getFirestore = (adapter: FirestoreAdapter) => {
    let cachedFirestoreInstance = get(adapter, 'firestore');
    if (!cachedFirestoreInstance) {
        const app = get(adapter, 'firebaseApp');
        cachedFirestoreInstance = app.firestore().then(firestore => {
            const settings = get(adapter, 'settings');
            firestore.settings(settings);
            const enablePersistence = get(adapter, 'enablePersistence');
            const fastboot = getOwner(adapter).lookup('service:fastboot');
            if (enablePersistence && (fastboot == null || !fastboot.isFastBoot)) {
                const persistenceSettings = get(adapter, 'persistenceSettings');
                firestore.enablePersistence(persistenceSettings).catch(console.warn);
            }
            return firestore;
        });
        set(adapter, 'firestore', cachedFirestoreInstance);
    }
    return cachedFirestoreInstance;
};
开发者ID:firebase,项目名称:emberfire,代码行数:19,代码来源:firestore.ts

示例7: set

const confirmOwner = (owner: IOwner, confirmedBy: string): IOwner['confirmedBy'] =>
  set(owner, 'confirmedBy', confirmedBy || null);
开发者ID:alyiwang,项目名称:WhereHows,代码行数:2,代码来源:owner.ts

示例8: finishedReloading

 finishedReloading() {
   this.isReloading = false;
   if (this.hasRecord) {
     set(this._record, 'isReloading', false);
   }
 }
开发者ID:emberjs,项目名称:data,代码行数:6,代码来源:internal-model.ts

示例9: startedReloading

 startedReloading() {
   this.isReloading = true;
   if (this.hasRecord) {
     set(this._record, 'isReloading', true);
   }
 }
开发者ID:emberjs,项目名称:data,代码行数:6,代码来源:internal-model.ts

示例10: run

 let ret = run(function() {
   return set(context, key, value);
 });
开发者ID:switchfly,项目名称:ember-test-helpers,代码行数:3,代码来源:setup-context.ts


注:本文中的@ember/object.set函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。