UNPKG

1.59 kBJavaScriptView Raw
1var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5 return c > 3 && r && Object.defineProperty(target, key, r), r;
6};
7import { customAttribute, TargetInstruction } from 'aurelia-templating';
8import { inject } from 'aurelia-dependency-injection';
9import { getLogger } from 'aurelia-logging';
10import { DOM } from 'aurelia-pal';
11/**
12 * Attribute to be placed on any element to have it emit the View Compiler's
13 * TargetInstruction into the debug console, giving you insight into all the
14 * parsed bindings, behaviors and event handers for the targeted element.
15 */
16var CompileSpy = /** @class */ (function () {
17 /**
18 * Creates and instanse of CompileSpy.
19 * @param element target element on where attribute is placed on.
20 * @param instruction instructions for how the target element should be enhanced.
21 */
22 function CompileSpy(element, instruction) {
23 getLogger('compile-spy').info(element.toString(), instruction);
24 }
25 CompileSpy = __decorate([
26 customAttribute('compile-spy'),
27 inject(DOM.Element, TargetInstruction)
28 ], CompileSpy);
29 return CompileSpy;
30}());
31export { CompileSpy };