UNPKG

3.23 kBJavaScriptView Raw
1/**
2 * @license
3 * Copyright Google Inc. All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8"use strict";
9var private_import_core_1 = require('./private_import_core');
10var StaticAndDynamicReflectionCapabilities = (function () {
11 function StaticAndDynamicReflectionCapabilities(staticDelegate) {
12 this.staticDelegate = staticDelegate;
13 this.dynamicDelegate = new private_import_core_1.ReflectionCapabilities();
14 }
15 StaticAndDynamicReflectionCapabilities.install = function (staticDelegate) {
16 private_import_core_1.reflector.updateCapabilities(new StaticAndDynamicReflectionCapabilities(staticDelegate));
17 };
18 StaticAndDynamicReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };
19 StaticAndDynamicReflectionCapabilities.prototype.factory = function (type) { return this.dynamicDelegate.factory(type); };
20 StaticAndDynamicReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) {
21 return isStaticType(type) ? this.staticDelegate.hasLifecycleHook(type, lcProperty) :
22 this.dynamicDelegate.hasLifecycleHook(type, lcProperty);
23 };
24 StaticAndDynamicReflectionCapabilities.prototype.parameters = function (type) {
25 return isStaticType(type) ? this.staticDelegate.parameters(type) :
26 this.dynamicDelegate.parameters(type);
27 };
28 StaticAndDynamicReflectionCapabilities.prototype.annotations = function (type) {
29 return isStaticType(type) ? this.staticDelegate.annotations(type) :
30 this.dynamicDelegate.annotations(type);
31 };
32 StaticAndDynamicReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {
33 return isStaticType(typeOrFunc) ? this.staticDelegate.propMetadata(typeOrFunc) :
34 this.dynamicDelegate.propMetadata(typeOrFunc);
35 };
36 StaticAndDynamicReflectionCapabilities.prototype.getter = function (name) { return this.dynamicDelegate.getter(name); };
37 StaticAndDynamicReflectionCapabilities.prototype.setter = function (name) { return this.dynamicDelegate.setter(name); };
38 StaticAndDynamicReflectionCapabilities.prototype.method = function (name) { return this.dynamicDelegate.method(name); };
39 StaticAndDynamicReflectionCapabilities.prototype.importUri = function (type) { return this.staticDelegate.importUri(type); };
40 StaticAndDynamicReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, runtime) {
41 return this.staticDelegate.resolveIdentifier(name, moduleUrl, runtime);
42 };
43 StaticAndDynamicReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) {
44 if (isStaticType(enumIdentifier)) {
45 return this.staticDelegate.resolveEnum(enumIdentifier, name);
46 }
47 else {
48 return null;
49 }
50 };
51 return StaticAndDynamicReflectionCapabilities;
52}());
53exports.StaticAndDynamicReflectionCapabilities = StaticAndDynamicReflectionCapabilities;
54function isStaticType(type) {
55 return typeof type === 'object' && type.name && type.filePath;
56}
57//# sourceMappingURL=static_reflection_capabilities.js.map
\No newline at end of file