本文整理汇总了TypeScript中ember-utils.symbol函数的典型用法代码示例。如果您正苦于以下问题:TypeScript symbol函数的具体用法?TypeScript symbol怎么用?TypeScript symbol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了symbol函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: create
normalizedName?: string;
create(props?: { [prop: string]: any }): T;
}
export interface Owner {
lookup<T>(fullName: string, options?: LookupOptions): T;
lookup(fullName: string, options?: LookupOptions): any;
factoryFor<T, C>(fullName: string, options?: LookupOptions): Factory<T, C> | undefined;
factoryFor(fullName: string, options?: LookupOptions): Factory<any, any> | undefined;
buildChildEngineInstance<T>(name: string): T;
hasRegistration(name: string, options?: LookupOptions): boolean;
}
import { symbol } from 'ember-utils';
export const OWNER = symbol('OWNER');
/**
Framework objects in an Ember application (components, services, routes, etc.)
are created via a factory and dependency injection system. Each of these
objects is the responsibility of an "owner", which handled its
instantiation and manages its lifetime.
`getOwner` fetches the owner object responsible for an instance. This can
be used to lookup or resolve other class instances, or register new factories
into the owner.
For example, this component dynamically looks up a service based on the
`audioType` passed as an attribute:
```app/components/play-audio.js
开发者ID:Artmann,项目名称:ember.js,代码行数:31,代码来源:index.ts
示例2: symbol
import { ComponentManager } from '@glimmer/runtime';
import { assert } from 'ember-debug';
import { Owner, symbol } from 'ember-utils';
import DefinitionState from '../component-managers/definition-state';
import ComponentStateBucket from '../utils/curly-component-state-bucket';
import { GLIMMER_CUSTOM_COMPONENT_MANAGER } from 'ember/features';
export const COMPONENT_MANAGER = symbol('COMPONENT_MANAGER');
export function componentManager(obj: any, managerId: String) {
if ('reopenClass' in obj) {
return obj.reopenClass({
[COMPONENT_MANAGER]: managerId
});
}
obj[COMPONENT_MANAGER] = managerId;
return obj;
}
export default function getCustomComponentManager(owner: Owner, obj: {}): ComponentManager<ComponentStateBucket, DefinitionState> | undefined {
if (!GLIMMER_CUSTOM_COMPONENT_MANAGER) { return; }
if (!obj) { return; }
let managerId = obj[COMPONENT_MANAGER];
if (!managerId) { return; }
开发者ID:selvaa89,项目名称:ember.js,代码行数:30,代码来源:custom-component-manager.ts
示例3: symbol
PROPERTY_DID_CHANGE,
} from 'ember-metal';
import { TargetActionSupport } from 'ember-runtime';
import { getOwner, NAME_KEY, symbol } from 'ember-utils';
import {
ActionSupport,
ChildViewsSupport,
ClassNamesSupport,
CoreView,
getViewElement,
ViewMixin,
ViewStateSupport,
} from 'ember-views';
import { RootReference, UPDATE } from './utils/references';
export const DIRTY_TAG = symbol('DIRTY_TAG');
export const ARGS = symbol('ARGS');
export const ROOT_REF = symbol('ROOT_REF');
export const IS_DISPATCHING_ATTRS = symbol('IS_DISPATCHING_ATTRS');
export const HAS_BLOCK = symbol('HAS_BLOCK');
export const BOUNDS = symbol('BOUNDS');
/**
@module @ember/component
*/
/**
A `Component` is a view that is completely
isolated. Properties accessed in its templates go
to the view object and actions are targeted at
the view object. There is no access to the
开发者ID:silver-curve,项目名称:ember.js,代码行数:31,代码来源:component.ts
示例4: symbol
if (DEBUG) {
counters = {
peekCalls: 0,
peekPrototypeWalks: 0,
setCalls: 0,
deleteCalls: 0,
metaCalls: 0,
metaInstantiated: 0,
};
}
/**
@module ember
*/
export const UNDEFINED = symbol('undefined');
// FLAGS
const SOURCE_DESTROYING = 1 << 1;
const SOURCE_DESTROYED = 1 << 2;
const META_DESTROYED = 1 << 3;
export class Meta {
_descriptors: any | undefined;
_watching: any | undefined;
_mixins: any | undefined;
_deps: any | undefined;
_chainWatchers: any | undefined;
_chains: any | undefined;
_tag: Tag | undefined;
_tags: any | undefined;
开发者ID:Artmann,项目名称:ember.js,代码行数:31,代码来源:meta.ts
示例5: symbol
} from 'ember-metal';
import {
symbol,
} from 'ember-utils';
import {
EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER,
MANDATORY_SETTER,
} from 'ember/features';
import {
HelperFunction,
HelperInstance,
RECOMPUTE_TAG,
} from '../helper';
import emberToBool from './to-bool';
export const UPDATE = symbol('UPDATE');
export const INVOKE = symbol('INVOKE');
export const ACTION = symbol('ACTION');
let maybeFreeze: (obj: any) => void;
if (DEBUG) {
// gaurding this in a DEBUG gaurd (as well as all invocations)
// so that it is properly stripped during the minification's
// dead code elimination
maybeFreeze = (obj: any) => {
// re-freezing an already frozen object introduces a significant
// performance penalty on Chrome (tested through 59).
//
// See: https://bugs.chromium.org/p/v8/issues/detail?id=6450
if (!Object.isFrozen(obj)) {
Object.freeze(obj);
开发者ID:KirillSuhodolov,项目名称:ember.js,代码行数:31,代码来源:references.ts
示例6: symbol
watchKey,
} from 'ember-metal';
import {
symbol,
} from 'ember-utils';
import {
EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER,
MANDATORY_SETTER,
} from 'ember/features';
import {
RECOMPUTE_TAG,
SimpleHelper,
} from '../helper';
import emberToBool from './to-bool';
export const UPDATE = symbol('UPDATE');
let maybeFreeze: (obj: any) => void;
if (DEBUG) {
// gaurding this in a DEBUG gaurd (as well as all invocations)
// so that it is properly stripped during the minification's
// dead code elimination
maybeFreeze = (obj: any) => {
// re-freezing an already frozen object introduces a significant
// performance penalty on Chrome (tested through 59).
//
// See: https://bugs.chromium.org/p/v8/issues/detail?id=6450
if (!Object.isFrozen(obj)) {
Object.freeze(obj);
}
};
开发者ID:jasonmit,项目名称:ember.js,代码行数:31,代码来源:references.ts
示例7: symbol
Increment count
</button>
```
You can also use the `value` option:
```handlebars
<input value={{name}} oninput={{action (mut name) value="target.value"}}>
```
@method mut
@param {Object} [attr] the "two-way" attribute that can be modified.
@for Ember.Templates.helpers
@public
*/
const MUT_REFERENCE = symbol('MUT');
const SOURCE = symbol('SOURCE');
export function isMut(ref: any): boolean {
return ref && ref[MUT_REFERENCE];
}
export function unMut(ref: any) {
return ref[SOURCE] || ref;
}
export default function(_vm: VM, args: Arguments) {
let rawRef = args.positional.at(0);
if (isMut(rawRef)) {
return rawRef;
开发者ID:jrjohnson,项目名称:ember.js,代码行数:31,代码来源:mut.ts
示例8: symbol
} from '@ember/deprecated-features';
import { DEBUG } from '@glimmer/env';
import { descriptorFor, Meta, peekMeta } from 'ember-meta';
import { symbol } from 'ember-utils';
import changeEvent from './change_event';
import { sendEvent } from './events';
import ObserverSet from './observer_set';
import { markObjectAsDirty } from './tags';
import { assertNotRendered } from './transaction';
/**
@module ember
@private
*/
export const PROPERTY_DID_CHANGE = symbol('PROPERTY_DID_CHANGE');
const observerSet = new ObserverSet();
let deferred = 0;
// ..........................................................
// PROPERTY CHANGES
//
/**
@method propertyWillChange
@for Ember
@private
*/
let propertyWillChange;
if (ENABLE_PROPERTY_WILL_CHANGE) {
开发者ID:chundabear,项目名称:ember.js,代码行数:31,代码来源:property_events.ts
示例9: if
if (typeof value === 'function' && value[ACTION]) {
attrs[name] = value;
} else if (ref[UPDATE]) {
attrs[name] = new MutableCell(ref, value);
}
args[name] = ref;
props[name] = value;
}
props.attrs = attrs;
return props;
}
const REF = symbol('REF');
class MutableCell {
public value: any;
constructor(ref: any, value: any) {
this[MUTABLE_CELL] = true;
this[REF] = ref;
this.value = value;
}
update(val: any) {
this[REF][UPDATE](val);
}
}
开发者ID:fpauser,项目名称:ember.js,代码行数:29,代码来源:process-args.ts
示例10: symbol
```handlebars
<ul>
{{#each-in user as |key value|}}
<li>{{key}}: {{value}}</li>
{{/each-in}}
</ul>
```
Outputting their name and age.
@method each-in
@for Ember.Templates.helpers
@public
@since 2.1.0
*/
const EACH_IN_REFERENCE = symbol('EACH_IN');
class EachInReference implements VersionedPathReference {
public tag: Tag;
constructor(private inner: VersionedPathReference) {
this.tag = inner.tag;
this[EACH_IN_REFERENCE] = true;
}
value(): Opaque {
return this.inner.value();
}
get(key: string): VersionedPathReference {
return this.inner.get(key);
开发者ID:Artmann,项目名称:ember.js,代码行数:31,代码来源:each-in.ts
注:本文中的ember-utils.symbol函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论