1 | "use strict";
|
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5 | 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;
|
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7 | };
|
8 | Object.defineProperty(exports, "__esModule", { value: true });
|
9 | var aurelia_templating_1 = require("aurelia-templating");
|
10 | var aurelia_logging_1 = require("aurelia-logging");
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | var ViewSpy = (function () {
|
17 | |
18 |
|
19 |
|
20 | function ViewSpy() {
|
21 | this.logger = aurelia_logging_1.getLogger('view-spy');
|
22 | }
|
23 | ViewSpy.prototype._log = function (lifecycleName, context) {
|
24 | if (!this.value && lifecycleName === 'created') {
|
25 | this.logger.info(lifecycleName, this.view);
|
26 | }
|
27 | else if (this.value && this.value.indexOf(lifecycleName) !== -1) {
|
28 | this.logger.info(lifecycleName, this.view, context);
|
29 | }
|
30 | };
|
31 | |
32 |
|
33 |
|
34 |
|
35 | ViewSpy.prototype.created = function (view) {
|
36 | this.view = view;
|
37 | this._log('created');
|
38 | };
|
39 | |
40 |
|
41 |
|
42 |
|
43 | ViewSpy.prototype.bind = function (bindingContext) {
|
44 | this._log('bind', bindingContext);
|
45 | };
|
46 | |
47 |
|
48 |
|
49 | ViewSpy.prototype.attached = function () {
|
50 | this._log('attached');
|
51 | };
|
52 | |
53 |
|
54 |
|
55 | ViewSpy.prototype.detached = function () {
|
56 | this._log('detached');
|
57 | };
|
58 | |
59 |
|
60 |
|
61 | ViewSpy.prototype.unbind = function () {
|
62 | this._log('unbind');
|
63 | };
|
64 | ViewSpy = __decorate([
|
65 | aurelia_templating_1.customAttribute('view-spy')
|
66 | ], ViewSpy);
|
67 | return ViewSpy;
|
68 | }());
|
69 | exports.ViewSpy = ViewSpy;
|