Skip to content

Commit

Permalink
Merge pull request emberjs#12526 from duggiefresh/remove-ember-metal-…
Browse files Browse the repository at this point in the history
…symbol

[CLEANUP beta] - Populate `ember-metal/symbol`
  • Loading branch information
rwjblue committed Nov 6, 2015
2 parents f9879f3 + 393b36a commit d38cadd
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/container/lib/owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@submodule ember-runtime
*/

import { symbol } from 'ember-metal/utils';
import symbol from 'ember-metal/symbol';

export const OWNER = symbol('OWNER');

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/keywords/closure-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { assert } from 'ember-metal/debug';
import isNone from 'ember-metal/is_none';
import { symbol } from 'ember-metal/utils';
import symbol from 'ember-metal/symbol';
import BasicStream from 'ember-metal/streams/stream';
import { read } from 'ember-metal/streams/utils';
import { labelForSubexpr } from 'ember-htmlbars/hooks/subexpr';
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/keywords/mut.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { assert } from 'ember-metal/debug';
import { symbol } from 'ember-metal/utils';
import symbol from 'ember-metal/symbol';
import ProxyStream from 'ember-metal/streams/proxy-stream';
import BasicStream from 'ember-metal/streams/stream';
import { isStream } from 'ember-metal/streams/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { instrument } from 'ember-htmlbars/system/instrumentation-support';
import LegacyEmberComponent from 'ember-views/components/component';
import GlimmerComponent from 'ember-htmlbars/glimmer-component';
import extractPositionalParams from 'ember-htmlbars/utils/extract-positional-params';
import { symbol } from 'ember-metal/utils';
import symbol from 'ember-metal/symbol';
import { setOwner } from 'container/owner';

// These symbols will be used to limit link-to's public API surface area.
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-metal/lib/property_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
accumulateListeners
} from 'ember-metal/events';
import ObserverSet from 'ember-metal/observer_set';
import { symbol } from 'ember-metal/utils';
import symbol from 'ember-metal/symbol';

export let PROPERTY_DID_CHANGE = symbol('PROPERTY_DID_CHANGE');

Expand Down
9 changes: 9 additions & 0 deletions packages/ember-metal/lib/symbol.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { GUID_KEY, intern } from 'ember-metal/utils';

export default function symbol(debugName) {
// TODO: Investigate using platform symbols, but we do not
// want to require non-enumerability for this API, which
// would introduce a large cost.

return intern(debugName + ' [id=' + GUID_KEY + Math.floor(Math.random() * new Date()) + ']');
}
10 changes: 1 addition & 9 deletions packages/ember-metal/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var stringCache = {};
@private
@return {String} interned version of the provided string
*/
function intern(str) {
export function intern(str) {
var obj = {};
obj[str] = 1;
for (var key in obj) {
Expand All @@ -91,14 +91,6 @@ function intern(str) {
return str;
}

export function symbol(debugName) {
// TODO: Investigate using platform symbols, but we do not
// want to require non-enumerability for this API, which
// would introduce a large cost.

return intern(debugName + ' [id=' + GUID_KEY + Math.floor(Math.random() * new Date()) + ']');
}

/**
A unique key used to assign guids and other private metadata to objects.
If you inspect an object in your browser debugger you will often see these.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
read,
readArray
} from 'ember-metal/streams/utils';
import { symbol } from 'ember-metal/utils';
import symbol from 'ember-metal/symbol';
import { get } from 'ember-metal/property_get';
import { labelForSubexpr } from 'ember-htmlbars/hooks/subexpr';
import EmberError from 'ember-metal/error';
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-runtime/lib/system/core_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
K
} from 'ember-metal/core';
import { validatePropertyInjections } from 'ember-runtime/inject';
import { symbol } from 'ember-metal/utils';
import symbol from 'ember-metal/symbol';

export let POST_INIT = symbol('POST_INIT');
var schedule = run.schedule;
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-views/lib/compat/attrs-proxy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Mixin } from 'ember-metal/mixin';
import { symbol } from 'ember-metal/utils';
import symbol from 'ember-metal/symbol';
import { PROPERTY_DID_CHANGE } from 'ember-metal/property_events';

export function deprecation(key) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-views/lib/mixins/view_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { computed } from 'ember-metal/computed';
import { Mixin } from 'ember-metal/mixin';
import { POST_INIT } from 'ember-runtime/system/core_object';
import isEnabled from 'ember-metal/features';
import { symbol } from 'ember-metal/utils';
import symbol from 'ember-metal/symbol';
import { getOwner } from 'container/owner';

const INIT_WAS_CALLED = symbol('INIT_WAS_CALLED');
Expand Down

0 comments on commit d38cadd

Please sign in to comment.