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


TypeScript object.get函数代码示例

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


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

示例1: 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

示例2: get

const setRouteSubscription = (service: RealtimeListenerService, route: Object, unsubscribe: (() => void)|null) => {
    const routeSubscriptions = get(service, `routeSubscriptions`);
    const existingSubscription = get(routeSubscriptions, route.toString());
    if (existingSubscription) { existingSubscription() }
    if (unsubscribe) {
        routeSubscriptions[route.toString()] = unsubscribe;
    } else {
        delete routeSubscriptions[route.toString()];
    }
}
开发者ID:firebase,项目名称:emberfire,代码行数:10,代码来源:realtime-listener.ts

示例3: get

 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;
 });
开发者ID:firebase,项目名称:emberfire,代码行数:11,代码来源:firestore.ts

示例4: 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

示例5: get

      return Object.keys(this.attrs).reduce((acc: ComponentAttributes, key) => {
        const value = get(this, key as keyof this);

        acc[key] = value;

        return acc;
      }, {});
开发者ID:dfreeman,项目名称:ember-cli-react,代码行数:7,代码来源:index.ts

示例6: _trackEvent

  /**
   * Invokes the metrics trackEvent service with options for the event being tracked
   * @memberof TrackUiEvent
   */
  _trackEvent(this: TrackUiEvent): void {
    const metrics = get(this, 'metrics');
    const { category, action, name, value }: IPiwikEvent = getProperties(this, ['category', 'action', 'name', 'value']);
    const resolvedOptions = Object.assign({}, { category, action }, !!name && { name }, !!value && { value });

    metrics.trackEvent(resolvedOptions);
  }
开发者ID:alyiwang,项目名称:WhereHows,代码行数:11,代码来源:track-ui-event.ts

示例7: currentURL

export function currentURL(): string {
  const context = getContext();
  if (!context || !isApplicationTestContext(context)) {
    throw new Error(
      'Cannot call `currentURL` without having first called `setupApplicationContext`.'
    );
  }

  let router = context.owner.lookup('router:main');

  if (HAS_CURRENT_URL_ON_ROUTER) {
    return get(router, 'currentURL');
  } else {
    return get(router, 'location').getURL();
  }
}
开发者ID:switchfly,项目名称:ember-test-helpers,代码行数:16,代码来源:setup-application-context.ts

示例8: _trackCurrentUser

  /**
   * On entry into route, track the currently logged in user
   * @return {Promise.<void>}
   * @private
   */
  async _trackCurrentUser() {
    const { tracking } = await Configurator.getConfig<undefined>();

    // Check if tracking is enabled prior to invoking
    // Passes an anonymous function to track the currently logged in user using the singleton `current-user` service
    return (
      tracking &&
      tracking.isEnabled &&
      get(this, 'sessionUser').trackCurrentUser(userId => get(this, 'metrics').identify({ userId }))
    );
  }
开发者ID:alyiwang,项目名称:WhereHows,代码行数:16,代码来源:index.ts

示例9: currentRouteName

export function currentRouteName(): string {
  const context = getContext();
  if (!context || !isApplicationTestContext(context)) {
    throw new Error(
      'Cannot call `currentRouteName` without having first called `setupApplicationContext`.'
    );
  }

  let router = context.owner.lookup('router:main');
  return get(router, 'currentRouteName');
}
开发者ID:switchfly,项目名称:ember-test-helpers,代码行数:11,代码来源:setup-application-context.ts

示例10: rollbackAttributes

  rollbackAttributes() {
    let dirtyKeys = this._recordData.rollbackAttributes();
    if (get(this, 'isError')) {
      this.didCleanError();
    }

    this.send('rolledBack');

    if (this._record && dirtyKeys && dirtyKeys.length > 0) {
      this._record._notifyProperties(dirtyKeys);
    }
  }
开发者ID:emberjs,项目名称:data,代码行数:12,代码来源:internal-model.ts


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