-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathva-load-behavior.html
More file actions
87 lines (76 loc) · 1.71 KB
/
va-load-behavior.html
File metadata and controls
87 lines (76 loc) · 1.71 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<link rel="import" href="./va-load-error-overcover.html">
<script>
VA.LoadBehavior = {
_getErrorCover: function () {
var ec = document.querySelector('va-load-error-overcover');
if (!ec) {
ec = document.createElement('va-load-error-overcover');
document.body.appendChild(ec);
}
return ec;
},
load: function (path) {
this.importHref(this.resolveUrl(path, null, null, true), this.closeError, this.openError);
},
openError: function () {
this._getErrorCover().open();
},
closeError: function () {
this._getErrorCover().close();
},
};
VA.ViewLoadBehaviorImpl = {
properties: {
page: {
type: String,
value: ''
},
view: {
type: String,
value: '',
observer: 'viewChanged'
}
},
viewChanged: function () {
if (this.view !== '') {
this.load(
VA.pageRoot
+ '/'
+ VA.prefix + '-' + this.page
+ '/'
+ VA.prefix + '-' + this.page + '-' + this.view
+ '.html'
);
}
}
};
VA.PageLoadBehaviorImpl = {
properties: {
page: {
type: String,
value: '',
observer: 'pageChanged'
}
},
pageChanged: function () {
if (this.page !== '') {
this.load(
VA.pageRoot
+ '/'
+ VA.prefix + '-' + this.page
+ '/'
+ VA.prefix + '-' + this.page
+ '.html'
);
}
},
};
VA.PageLoadBehavior = [
VA.LoadBehavior,
VA.PageLoadBehaviorImpl
];
VA.ViewLoadBehavior = [
VA.LoadBehavior,
VA.ViewLoadBehaviorImpl
];
</script>