• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript application.getOwner函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript application.setOwner函数代码示例发布时间:2022-05-28
下一篇:
TypeScript application.extend函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap