-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
ember-internals.js
33 lines (30 loc) · 1006 Bytes
/
ember-internals.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import Ember from 'ember';
let __EMBER_METAL__;
let emberMetalPaths = [
'@ember/-internals/metal', // ember-source from 3.10
'@ember/-internals/metal/index' // ember-source from 3.13
];
let metalPath = emberMetalPaths.find(path => Ember.__loader.registry[path]);
if (metalPath) {
__EMBER_METAL__ = Ember.__loader.require(metalPath);
}
export function getDependentKeys(descriptorOrDecorator) {
if (__EMBER_METAL__ && __EMBER_METAL__.descriptorForDecorator) {
let descriptor = __EMBER_METAL__.descriptorForDecorator(
descriptorOrDecorator
);
//TODO: GJ: why is `descriptor._dependentKeys` null in 3.13.0-beta.4?
return descriptor._dependentKeys;
} else {
return descriptorOrDecorator._dependentKeys;
}
}
export function isDescriptor(o) {
if (__EMBER_METAL__ && __EMBER_METAL__.isClassicDecorator) {
return __EMBER_METAL__.isClassicDecorator(o);
} else {
return (
o && (typeof o === 'object' || typeof o === 'function') && o.isDescriptor
);
}
}