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


TypeScript reference.VersionedPathReference类代码示例

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


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

示例1: constructor

  constructor(
    root: Opaque,
    env: Environment,
    template: OwnedTemplate,
    self: VersionedPathReference<Opaque>,
    parentElement: Simple.Element,
    dynamicScope: DynamicScope) {
    assert(`You cannot render \`${self.value()}\` without a template.`, template !== undefined);

    this.id = getViewId(root);
    this.env = env;
    this.root = root;
    this.result = undefined;
    this.shouldReflush = false;
    this.destroyed = false;

    let options = this.options = {
      alwaysRevalidate: false,
    };

    this.render = () => {
      let iterator = template.render(self, parentElement, dynamicScope);
      let iteratorResult: IteratorResult<RenderResult>;

      do {
        iteratorResult = iterator.next();
      } while (!iteratorResult.done);

      let result = this.result = iteratorResult.value;

      // override .render function after initial render
      this.render = () => result.rerender(options);
    };
  }
开发者ID:jasonmit,项目名称:ember.js,代码行数:34,代码来源:renderer.ts

示例2: create

 static create(parentReference: VersionedPathReference<Opaque>, propertyKey: string) {
   if (isConst(parentReference)) {
     return new RootPropertyReference(parentReference.value(), propertyKey);
   } else {
     return new NestedPropertyReference(parentReference, propertyKey);
   }
 }
开发者ID:cibernox,项目名称:ember.js,代码行数:7,代码来源:references.ts

示例3: create

  create(environment: Environment, definition: CurlyComponentDefinition, args: Arguments, dynamicScope: DynamicScope, callerSelfRef: VersionedPathReference<Opaque>, hasBlock: boolean): ComponentStateBucket {
    if (DEBUG) {
      this._pushToDebugStack(`component:${definition.name}`, environment);
    }

    let parentView = dynamicScope.view;

    let factory = definition.ComponentClass;

    let capturedArgs = args.named.capture();
    let props = processComponentArgs(capturedArgs);

    aliasIdToElementId(args, props);

    props.parentView = parentView;
    props[HAS_BLOCK] = hasBlock;

    props._targetObject = callerSelfRef.value();

    let component = factory.create(props);

    let finalizer = _instrumentStart('render.component', initialRenderInstrumentDetails, component);

    dynamicScope.view = component;

    if (parentView !== null && parentView !== undefined) {
      parentView.appendChild(component);
    }

    // We usually do this in the `didCreateElement`, but that hook doesn't fire for tagless components
    if (component.tagName === '') {
      if (environment.isInteractive) {
        component.trigger('willRender');
      }

      component._transitionTo('hasElement');

      if (environment.isInteractive) {
        component.trigger('willInsertElement');
      }
    }

    let bucket = new ComponentStateBucket(environment, component, capturedArgs, finalizer);

    if (args.named.has('class')) {
      bucket.classRef = args.named.get('class');
    }

    if (DEBUG) {
      processComponentInitializationAssertions(component, props);
    }

    if (environment.isInteractive && component.tagName !== '') {
      component.trigger('willRender');
    }

    return bucket;
  }
开发者ID:fpauser,项目名称:ember.js,代码行数:58,代码来源:curly.ts

示例4: referenceFromPath

function referenceFromPath(source: VersionedPathReference<Opaque>, path: string): VersionedPathReference<Opaque> {
  let innerReference;
  if (path === undefined || path === null || path === '') {
    innerReference = NULL_REFERENCE;
  } else if (typeof path === 'string' && path.indexOf('.') > -1) {
    innerReference = referenceFromParts(source, path.split('.'));
  } else {
    innerReference = source.get(path);
  }
  return innerReference;
}
开发者ID:GowthamMK,项目名称:ember.js,代码行数:11,代码来源:get.ts

示例5: stateFor

function stateFor(ref: VersionedPathReference<OutletState | undefined>): OutletDefinitionState | null {
  let outlet = ref.value();
  if (outlet === undefined) return null;
  let render = outlet.render;
  if (render === undefined) return null;
  let template = render.template;
  if (template === undefined) return null;
  return {
    ref,
    name: render.name,
    outlet: render.outlet,
    template,
    controller: render.controller,
  };
}
开发者ID:GowthamMK,项目名称:ember.js,代码行数:15,代码来源:outlet.ts

示例6: value

    value(): Opaque {
      let value = this.component.value();

      assert(this.message, typeof value !== 'string');

      return value;
    }
开发者ID:cibernox,项目名称:ember.js,代码行数:7,代码来源:-assert-implicit-component-helper-argument.ts

示例7: value

  value() {
    let { env, nameRef, modelRef } = this;
    let name = nameRef.value();

    if (typeof name === 'string') {
      if (this._lastName === name) {
        return this._lastDef;
      }

      assert(
        `You used \`{{mount '${name}'}}\`, but the engine '${name}' can not be found.`,
        env.owner.hasRegistration(`engine:${name}`)
      );

      if (!env.owner.hasRegistration(`engine:${name}`)) {
        return null;
      }

      this._lastName = name;
      this._lastDef = curry(new MountDefinition(name, modelRef));

      return this._lastDef;
    } else {
      assert(
        `Invalid engine name '${name}' specified, engine name must be either a string, null or undefined.`,
        name === null || name === undefined
      );
      this._lastDef = null;
      this._lastName = null;
      return null;
    }
  }
开发者ID:chundabear,项目名称:ember.js,代码行数:32,代码来源:mount.ts

示例8: get

    readValue = (args: any) => {
      let valuePath = valuePathRef.value();

      if (valuePath && args.length > 0) {
        args[0] = get(args[0], valuePath as string);
      }

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

示例9: TypeError

    value(): Opaque {
      let value = this.component.value();

      if (typeof value === 'string') {
        throw new TypeError(this.message);
      }

      return value;
    }
开发者ID:sbatson5,项目名称:ember.js,代码行数:9,代码来源:-assert-implicit-component-helper-argument.ts

示例10: compute

  compute() {
    let { lastPath, innerReference, innerTag } = this;
    let path = this.pathReference.value();

    if (path !== lastPath) {
      innerReference = referenceFromPath(this.sourceReference, path);
      innerTag.inner.update(innerReference.tag);
      this.innerReference = innerReference;
      this.lastPath = path;
    }

    return innerReference.value();
  }
开发者ID:GowthamMK,项目名称:ember.js,代码行数:13,代码来源:get.ts


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