當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。