當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript application.getOwner函數代碼示例

本文整理匯總了TypeScript中@ember/application.getOwner函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getOwner函數的具體用法?TypeScript getOwner怎麽用?TypeScript getOwner使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了getOwner函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: beforeModel

  async beforeModel() {
    await runMigrations(getOwner(this));
    await ensureRelays(getOwner(this));

    // TODO: check all the modern web requirements
    await this.locale.setLocale(this.locale.currentLocale);
    await this.currentUser.load();
  }
開發者ID:NullVoxPopuli,項目名稱:emberclear,代碼行數:8,代碼來源:route.ts

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

示例3: modelFactoryFor

  private modelFactoryFor(type: string) {
    let modelFactory = this._modelFactoryMap[type];

    if (!modelFactory) {
      let owner = getOwner(this._store);
      let orbitConfig = owner.lookup('ember-orbit:config');
      modelFactory = owner.factoryFor(`${orbitConfig.types.model}:${type}`);
      this._modelFactoryMap[type] = modelFactory;
    }

    return modelFactory;
  }
開發者ID:orbitjs,項目名稱:ember-orbit,代碼行數:12,代碼來源:model-factory.ts

示例4: mountElement

    private mountElement() {
      const props = this.getPropsForReact();
      let { children } = props;

      if (!children) {
        const childNodes = this.element.childNodes;
        children = [
          React.createElement(YieldWrapper, {
            key: get(this, 'elementId'),
            nodes: [...childNodes]
          })
        ];
      }

      const owner = getOwner(this);
      const KlassWithOwner = grantOwnerAccess(Klass, owner);

      ReactDOM.render(
        React.createElement(KlassWithOwner, props, children),
        this.element
      );
    }
開發者ID:dfreeman,項目名稱:ember-cli-react,代碼行數:22,代碼來源:index.ts

示例5: config

 /**
  * Returns the config for this application
  */
 @computed
 get config() : any {
   return getOwner(this).resolveRegistration('config:environment');
 }
開發者ID:pjcarly,項目名稱:ember-mist-components,代碼行數:7,代碼來源:component.ts

示例6: getOwner

const isFastboot = (object:Object) => {
    const fastboot = getOwner(object).lookup('service:fastboot');
    return fastboot && fastboot.isFastBoot;
}
開發者ID:firebase,項目名稱:emberfire,代碼行數:4,代碼來源:realtime-listener.ts

示例7: getRecord

  getRecord(properties?) {
    if (!this._record && !this._isDematerializing) {
      let { store } = this;

      // lookupFactory should really return an object that creates
      // instances with the injections applied
      let createOptions: any = {
        store,
        _internalModel: this,
        currentState: this.currentState,
        isError: this.isError,
        adapterError: this.error,
      };

      if (properties !== undefined) {
        assert(
          `You passed '${properties}' as properties for record creation instead of an object.`,
          typeof properties === 'object' && properties !== null
        );

        if ('id' in properties) {
          this.setId(properties.id);
        }

        // convert relationship Records to RecordDatas before passing to RecordData
        let defs = store._relationshipsDefinitionFor(this.modelName);

        if (defs !== null) {
          let keys = Object.keys(properties);
          let relationshipValue;

          for (let i = 0; i < keys.length; i++) {
            let prop = keys[i];
            let def = defs[prop];

            if (def !== undefined) {
              if (def.kind === 'hasMany') {
                if (DEBUG) {
                  assertRecordsPassedToHasMany(properties[prop]);
                }
                relationshipValue = extractRecordDatasFromRecords(properties[prop]);
              } else {
                relationshipValue = extractRecordDataFromRecord(properties[prop]);
              }

              properties[prop] = relationshipValue;
            }
          }
        }
      }

      let additionalCreateOptions = this._recordData._initRecordCreateOptions(properties);
      assign(createOptions, additionalCreateOptions);

      if (setOwner) {
        // ensure that `getOwner(this)` works inside a model instance
        setOwner(createOptions, getOwner(store));
      } else {
        createOptions.container = store.container;
      }

      this._record = store._modelFactoryFor(this.modelName).create(createOptions);

      this._triggerDeferredTriggers();
    }

    return this._record;
  }
開發者ID:emberjs,項目名稱:data,代碼行數:68,代碼來源:internal-model.ts

示例8: provider

 @computed('src')
 get provider(): Provider {
   return getOwner(this).lookup('ember-oembed:provider-for-url')(this.get('src'));
 }
開發者ID:levanto-financial,項目名稱:ember-oembed,代碼行數:4,代碼來源:ember-oembed.ts

示例9: endpoint

 /**
  * Get the endpoint from the config
  */
 @computed
 get endpoint() {
   const config = getOwner(this).resolveRegistration('config:environment');
   return config.apiEndpoint;
 }
開發者ID:pjcarly,項目名稱:ember-mist-components,代碼行數:8,代碼來源:ajax.ts


注:本文中的@ember/application.getOwner函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。