当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript aurelia-templating.ViewSlot类代码示例

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


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

示例1: compile

  compile(element: HTMLElement, fragment: Element | DocumentFragment | string, context: any, overrideContext: any = undefined) {
    element.classList.remove('au-target');
    let view = this.viewCompiler.compile(fragment, this.resources).create(this.container);

    let viewSlot = new ViewSlot(element, true, undefined);
    viewSlot.add(view);
    viewSlot.bind(context, overrideContext);
    viewSlot.attached();
    return viewSlot;
  }
开发者ID:LazerFX,项目名称:marvelous-aurelia-core,代码行数:10,代码来源:compiler.ts

示例2: ViewSlot

 return this.viewEngine.loadViewFactory(templateUrl).then(x => {
   let view = x.create(this.container);
   let viewSlot = new ViewSlot(element, true, undefined);
   
   viewSlot.add(view);
   viewSlot.bind(ctx, undefined);
   viewSlot.attached();
   
   return viewSlot;
 });
开发者ID:LazerFX,项目名称:marvelous-aurelia-core,代码行数:10,代码来源:compiler.ts

示例3: createController

// creates a controller given a html template string and a viewmodel instance.
function createController(template, viewModel, viewsRequireLifecycle?: boolean) {
  let childContainer = container.createChild();

  let viewFactory = viewCompiler.compile(template);

  if (viewsRequireLifecycle !== undefined) {
    for (let id in viewFactory.instructions) {
      let targetInstruction = viewFactory.instructions[id];
      for (let behaviorInstruction of targetInstruction.behaviorInstructions) {
      if (behaviorInstruction.attrName === 'repeat') {
        behaviorInstruction.viewFactory._viewsRequireLifecycle = viewsRequireLifecycle;
      }
      }
    }
  }

  let metadata = new HtmlBehaviorResource();
  function App() {
    //
  }
  metadata.initialize(childContainer, App);
  metadata.elementName = metadata.htmlName = 'app';

  let controller = metadata.create(childContainer, BehaviorInstruction.dynamic(host, viewModel, viewFactory));
  controller.automate();

  viewSlot.removeAll();
  viewSlot.add(controller.view);

  return controller;
}
开发者ID:aurelia,项目名称:templating-resources,代码行数:32,代码来源:repeat-integration.spec.ts

示例4: hide

  hide() {
    if (!this.tooltipHovering) {
      this._viewSlot.unbind();
      this._viewSlot.detached();

      this._element.removeEventListener('mouseenter', this.tooltipHovered);
      this._element.removeEventListener('mouseleave', this.tooltipHovered);

      // stop Tether from caring about this.element
      // do not delete the reference to this.tether because it will probably be used again
      if (this._tether) {
        this._tether.destroy();
      }
      DOM.removeNode(this._element);
    }
  }
开发者ID:Thanood,项目名称:monterey,代码行数:16,代码来源:tooltip-renderer.ts

示例5: bind

  /**
   * Binds the replaceable to the binding context and override context.
   * @param bindingContext The binding context.
   * @param overrideContext An override context for binding.
   */
  bind(bindingContext, overrideContext) {
    if (this.view === null) {
      this.view = (this.viewFactory as any).create();
      this.viewSlot.add(this.view);
    }

    this.view.bind(bindingContext, overrideContext);
  }
开发者ID:aurelia,项目名称:templating-resources,代码行数:13,代码来源:replaceable.ts

示例6:

  /**
   * @internal
   */
  _hide() {
    if (!this.showing) {
      return;
    }

    this.showing = false;
    let removed = this.viewSlot.remove(this.view); // Promise or View

    if (removed instanceof Promise) {
      return removed.then(() => {
        this._unbindView();
      });
    }

    this._unbindView();
  }
开发者ID:aurelia,项目名称:templating-resources,代码行数:19,代码来源:if-core.ts

示例7: show

  show(target: Element) {
    this._viewSlot.attached();

    this._element.addEventListener('mouseenter', this.tooltipHovered.bind(this));
    this._element.addEventListener('mouseleave', this.tooltipHovered.bind(this));

    this._tether = new Tether({
      element: this._element,
      target,
      classes: {
        element: false,
        target: false,
        enabled: false,
      },
      classPrefix: 'tooltip',
      attachment: 'bottom left',
      constraints: [{ to: 'window', attachment: 'together' }]
    });
    this._tether.position();
  }
开发者ID:Thanood,项目名称:monterey,代码行数:20,代码来源:tooltip-renderer.ts

示例8: unbind

  unbind() {
    if (this.view === null) {
      return;
    }

    this.view.unbind();

    // It seems to me that this code is subject to race conditions when animating.
    // For example a view could be returned to the cache and reused while it's still
    // attached to the DOM and animated.
    if (!this.viewFactory.isCaching) {
      return;
    }

    if (this.showing) {
      this.showing = false;
      this.viewSlot.remove(this.view, /*returnToCache:*/true, /*skipAnimation:*/true);
    } else {
      this.view.returnToCache();
    }

    this.view = null;
  }
开发者ID:aurelia,项目名称:templating-resources,代码行数:23,代码来源:if-core.ts


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