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

TypeScript owner.getOwner函数代码示例

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

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



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

示例1: function

  let getInjection = function(this: any, propertyName: string) {
    let owner = getOwner(this) || this.container; // fallback to `container` for backwards compat

    assert(
      `Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.`,
      Boolean(owner)
    );

    return owner.lookup(`${type}:${name || propertyName}`, { source, namespace });
  };
开发者ID:cibernox,项目名称:ember.js,代码行数:10,代码来源:injected_property.ts


示例2: getOwner

          !(() => {
            let eventDispatcher = getOwner(this).lookup<any | undefined>('event_dispatcher:main');
            let events = (eventDispatcher && eventDispatcher._finalEvents) || {};

            // tslint:disable-next-line:forin
            for (let key in events) {
              let methodName = events[key];

              if (typeof this[methodName] === 'function') {
                return true; // indicate that the assertion should be triggered
              }
            }
            return false;
          })()
开发者ID:GreatWizard,项目名称:ember.js,代码行数:14,代码来源:component.ts


示例3: injectedPropertyGet

function injectedPropertyGet(this: any, keyName: string): any {
  let desc = descriptorFor(this, keyName);
  let owner = getOwner(this) || this.container; // fallback to `container` for backwards compat

  assert(
    `InjectedProperties should be defined with the inject computed property macros.`,
    desc && desc.type
  );
  assert(
    `Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.`,
    !!owner
  );

  let specifier = `${desc.type}:${desc.name || keyName}`;
  return owner.lookup(specifier, {
    source: desc.source,
    namespace: desc.namespace,
  });
}
开发者ID:GreatWizard,项目名称:ember.js,代码行数:19,代码来源:injected_property.ts


示例4: prefixRouteNameArg

export function prefixRouteNameArg(route: Route, args: any[]) {
  let routeName = args[0];
  let owner = getOwner(route);
  let prefix = owner.mountPoint;

  // only alter the routeName if it's actually referencing a route.
  if (owner.routable && typeof routeName === 'string') {
    if (resemblesURL(routeName)) {
      throw new EmberError(
        'Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.'
      );
    } else {
      routeName = `${prefix}.${routeName}`;
      args[0] = routeName;
    }
  }

  return args;
}
开发者ID:Turbo87,项目名称:ember.js,代码行数:19,代码来源:utils.ts


示例5: init

  Input = Component.extend({
    tagName: '',

    init() {
      if (DEBUG) {
        this[DISABLE_TAGLESS_EVENT_CHECK] = true;
      }
      this._super(...arguments);
    },

    isCheckbox: computed('type', function(this: { type?: unknown }) {
      return this.type === 'checkbox';
    }),

    __injectEvents(target: any) {
      let eventDispatcher = getOwner(this).lookup<any | undefined>('event_dispatcher:main');
      let events: Dict<string> = (eventDispatcher && eventDispatcher._finalEvents) || {};
      Object.values(events).forEach(key => {
        if (this[key]) {
          target[key] = this[key];
        }
      });
    },
  });

  Input.toString = () => '@ember/component/input';

  if (DEBUG) {
    const UNSET = {};

    Input.reopen({
开发者ID:mixonic,项目名称:ember.js,代码行数:31,代码来源:input.ts


示例6: create

 create(injections: Injections): OwnedTemplate {
   const owner = getOwner(injections);
   return this.factory.create(injections.compiler, { owner });
 }
开发者ID:GreatWizard,项目名称:ember.js,代码行数:4,代码来源:template.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript owner.Owner类代码示例发布时间:2022-05-28
下一篇:
TypeScript metal.watchKey函数代码示例发布时间: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