本文整理匯總了TypeScript中@glimmer/reference.VersionedPathReference.value方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript VersionedPathReference.value方法的具體用法?TypeScript VersionedPathReference.value怎麽用?TypeScript VersionedPathReference.value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@glimmer/reference.VersionedPathReference
的用法示例。
在下文中一共展示了VersionedPathReference.value方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: create
static create(parentReference: VersionedPathReference<Opaque>, propertyKey: string) {
if (isConst(parentReference)) {
return new RootPropertyReference(parentReference.value(), propertyKey);
} else {
return new NestedPropertyReference(parentReference, propertyKey);
}
}
示例2: 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;
}
}
示例3: 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);
};
}
示例4: value
value(): Opaque {
let value = this.component.value();
assert(this.message, typeof value !== 'string');
return value;
}
示例5: 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;
}
示例6: get
readValue = (args: any) => {
let valuePath = valuePathRef.value();
if (valuePath && args.length > 0) {
args[0] = get(args[0], valuePath as string);
}
return args;
};
示例7: value
value(): Opaque {
let value = this.component.value();
if (typeof value === 'string') {
throw new TypeError(this.message);
}
return value;
}
示例8: 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();
}
示例9: 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,
};
}
示例10: create
create(
_env: Environment,
{ ComponentClass }: InternalDefinitionState,
args: Arguments,
_dynamicScope: DynamicScope,
caller: VersionedPathReference
): InputComponentState {
assert('caller must be const', isConst(caller));
let type = args.named.get('type');
let instance = ComponentClass.create({
caller: caller.value(),
type: type.value(),
});
return { type, instance };
}