Skip to content

Commit b348142

Browse files
Replace mounted method in favor of EventListener.
1 parent f98054e commit b348142

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to `vue-scroll-indicator` will be documented in this file.
44

55
## [0.1.1] - TBA
66

7+
### Changed
8+
- Replace mounted `scrollHandler()` in favor of `EventListener('load')`.
9+
710
### Fixed
811
- Rename data `document` > `docHeight`.
912

dist/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
143143
}
144144
},
145145
mounted: function mounted() {
146-
this.scrollHandler();
146+
//
147147
},
148148
created: function created() {
149+
window.addEventListener('load', this.scrollHandler);
149150
window.addEventListener('scroll', this.scrollHandler);
150151
},
151152
destroyed: function destroyed() {
153+
window.removeEventListener('load', this.scrollHandler);
152154
window.removeEventListener('scroll', this.scrollHandler);
153155
},
154156
data: function data() {

docs/build/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11171,12 +11171,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1117111171
}
1117211172
},
1117311173
mounted: function mounted() {
11174-
this.scrollHandler();
11174+
//
1117511175
},
1117611176
created: function created() {
11177+
window.addEventListener('load', this.scrollHandler);
1117711178
window.addEventListener('scroll', this.scrollHandler);
1117811179
},
1117911180
destroyed: function destroyed() {
11181+
window.removeEventListener('load', this.scrollHandler);
1118011182
window.removeEventListener('scroll', this.scrollHandler);
1118111183
},
1118211184
data: function data() {

src/components/VueScrollIndicator.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ export default {
3939
},
4040
},
4141
mounted() {
42-
this.scrollHandler();
42+
//
4343
},
4444
created() {
45+
window.addEventListener('load', this.scrollHandler);
4546
window.addEventListener('scroll', this.scrollHandler);
4647
},
4748
destroyed() {
49+
window.removeEventListener('load', this.scrollHandler);
4850
window.removeEventListener('scroll', this.scrollHandler);
4951
},
5052
data() {

0 commit comments

Comments
 (0)