当前位置: 首页>>代码示例>>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;未经允许,请勿转载。