當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript utils.symbol函數代碼示例

本文整理匯總了TypeScript中@ember/-internals/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/-internals/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:knownasilya,項目名稱:ember.js,代碼行數:31,代碼來源:index.ts

示例2: symbol

import { descriptorFor, Meta, peekMeta } from '@ember/-internals/meta';
import { symbol } from '@ember/-internals/utils';
import { DEBUG } from '@glimmer/env';
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;

/**
  This function is called just after an object property has changed.
  It will notify any observers and clear caches among other things.

  Normally you will not need to call this method directly but if for some
  reason you can't directly watch a property you can invoke this method
  manually.

  @method notifyPropertyChange
  @for @ember/object
  @param {Object} obj The object with the property that will change
  @param {String} keyName The property key (or path) that will change.
開發者ID:kategengler,項目名稱:ember.js,代碼行數:31,代碼來源:property_events.ts

示例3: symbol

import {
  ActionSupport,
  ChildViewsSupport,
  ClassNamesSupport,
  CoreView,
  getViewElement,
  ViewMixin,
  ViewStateSupport,
} from '@ember/-internals/views';
import { assert } from '@ember/debug';
import { DirtyableTag } from '@glimmer/reference';
import { normalizeProperty, SVG_NAMESPACE } from '@glimmer/runtime';

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:GreatWizard,項目名稱:ember.js,代碼行數:31,代碼來源:component.ts

示例4: symbol

import { Meta, meta as metaFor } from '@ember/-internals/meta';
import { isProxy, setupMandatorySetter, symbol } from '@ember/-internals/utils';
import { EMBER_METAL_TRACKED_PROPERTIES } from '@ember/canary-features';
import { backburner } from '@ember/runloop';
import { DEBUG } from '@glimmer/env';
import {
  combine,
  CONSTANT_TAG,
  DirtyableTag,
  Tag,
  TagWrapper,
  UpdatableTag,
} from '@glimmer/reference';

export const UNKNOWN_PROPERTY_TAG = symbol('UNKNOWN_PROPERTY_TAG');

function makeTag(): TagWrapper<DirtyableTag> {
  return DirtyableTag.create();
}

export function tagForProperty(object: any, propertyKey: string | symbol, _meta?: Meta): Tag {
  let objectType = typeof object;
  if (objectType !== 'function' && (objectType !== 'object' || object === null)) {
    return CONSTANT_TAG;
  }
  let meta = _meta === undefined ? metaFor(object) : _meta;

  if (EMBER_METAL_TRACKED_PROPERTIES) {
    if (!(propertyKey in object) && typeof object[UNKNOWN_PROPERTY_TAG] === 'function') {
      return object[UNKNOWN_PROPERTY_TAG](propertyKey);
    }
開發者ID:emberjs,項目名稱:ember.js,代碼行數:31,代碼來源:tags.ts

示例5: symbol

  Tag,
  TagWrapper,
  UpdatableTag,
  VersionedPathReference,
  VersionedReference,
} from '@glimmer/reference';
import {
  CapturedArguments,
  ConditionalReference as GlimmerConditionalReference,
  PrimitiveReference,
} from '@glimmer/runtime';
import { Option, unreachable } from '@glimmer/util';
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:cibernox,項目名稱:ember.js,代碼行數:31,代碼來源:references.ts

示例6: symbol

/**
@module @ember/object
*/
import { descriptorFor, isDescriptor, meta } from '@ember/-internals/meta';
import { HAS_NATIVE_PROXY, symbol, toString } from '@ember/-internals/utils';
import { EMBER_METAL_TRACKED_PROPERTIES } from '@ember/canary-features';
import { assert, deprecate } from '@ember/debug';
import { PROPERTY_BASED_DESCRIPTORS } from '@ember/deprecated-features';
import { DEBUG } from '@glimmer/env';
import { isPath } from './path_cache';
import { tagForProperty } from './tags';
import { getCurrentTracker } from './tracked';

export const PROXY_CONTENT = symbol('PROXY_CONTENT');

export let getPossibleMandatoryProxyValue: (obj: object, keyName: string) => any;

if (DEBUG && HAS_NATIVE_PROXY) {
  getPossibleMandatoryProxyValue = function getPossibleMandatoryProxyValue(obj, keyName) {
    let content = obj[PROXY_CONTENT];
    if (content === undefined) {
      return obj[keyName];
    } else {
      /* global Reflect */
      return Reflect.get(content, keyName, obj);
    }
  };
}

interface MaybeHasUnknownProperty {
  unknownProperty?: (keyName: string) => any;
開發者ID:knownasilya,項目名稱:ember.js,代碼行數:31,代碼來源:property_get.ts

示例7: symbol

    Increment count
  </button>
  ```

  You can also use the `value` option:

  ```handlebars
  <input value={{name}} oninput={{fn (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:emberjs,項目名稱:ember.js,代碼行數:31,代碼來源:mut.ts

示例8: 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:luxferresum,項目名稱:ember.js,代碼行數:31,代碼來源:meta.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:GreatWizard,項目名稱: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:GreatWizard,項目名稱:ember.js,代碼行數:31,代碼來源:each-in.ts


注:本文中的@ember/-internals/utils.symbol函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。