1 | var __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 | };
|
7 | import { customAttribute } from 'aurelia-templating';
|
8 | import { getLogger } from 'aurelia-logging';
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | var ViewSpy = (function () {
|
15 | |
16 |
|
17 |
|
18 | function ViewSpy() {
|
19 | this.logger = getLogger('view-spy');
|
20 | }
|
21 | ViewSpy.prototype._log = function (lifecycleName, context) {
|
22 | if (!this.value && lifecycleName === 'created') {
|
23 | this.logger.info(lifecycleName, this.view);
|
24 | }
|
25 | else if (this.value && this.value.indexOf(lifecycleName) !== -1) {
|
26 | this.logger.info(lifecycleName, this.view, context);
|
27 | }
|
28 | };
|
29 | |
30 |
|
31 |
|
32 |
|
33 | ViewSpy.prototype.created = function (view) {
|
34 | this.view = view;
|
35 | this._log('created');
|
36 | };
|
37 | |
38 |
|
39 |
|
40 |
|
41 | ViewSpy.prototype.bind = function (bindingContext) {
|
42 | this._log('bind', bindingContext);
|
43 | };
|
44 | |
45 |
|
46 |
|
47 | ViewSpy.prototype.attached = function () {
|
48 | this._log('attached');
|
49 | };
|
50 | |
51 |
|
52 |
|
53 | ViewSpy.prototype.detached = function () {
|
54 | this._log('detached');
|
55 | };
|
56 | |
57 |
|
58 |
|
59 | ViewSpy.prototype.unbind = function () {
|
60 | this._log('unbind');
|
61 | };
|
62 | ViewSpy = __decorate([
|
63 | customAttribute('view-spy')
|
64 | ], ViewSpy);
|
65 | return ViewSpy;
|
66 | }());
|
67 | export { ViewSpy };
|