當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。