Skip to content

Commit 3f2f688

Browse files
committed
Remove warnings for deprecated $ref emit pattern
1 parent a0c39dc commit 3f2f688

File tree

2 files changed

+3
-37
lines changed

2 files changed

+3
-37
lines changed

src/components/InfiniteLoading.vue

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export default /* #__PURE__ */defineComponent({
115115
this.scrollParent.addEventListener('scroll', this.scrollHandler, evt3rdArg);
116116
}, 1);
117117
118-
eventHub.$on('$InfiniteLoading:loaded', (ev) => {
118+
eventHub.$on('$InfiniteLoading:loaded', () => {
119119
this.isFirstLoad = false;
120120
121121
if (this.direction === 'top') {
@@ -128,13 +128,9 @@ export default /* #__PURE__ */defineComponent({
128128
if (this.status === STATUS.LOADING) {
129129
this.$nextTick(this.attemptLoad.bind(null, true));
130130
}
131-
132-
if (!ev || ev.target !== this) {
133-
warn(WARNINGS.STATE_CHANGER);
134-
}
135131
});
136132
137-
eventHub.$on('$InfiniteLoading:complete', (ev) => {
133+
eventHub.$on('$InfiniteLoading:complete', () => {
138134
this.status = STATUS.COMPLETE;
139135
140136
// force re-complation computed properties to fix the problem of get slot text delay
@@ -143,13 +139,9 @@ export default /* #__PURE__ */defineComponent({
143139
});
144140
145141
this.scrollParent.removeEventListener('scroll', this.scrollHandler, evt3rdArg);
146-
147-
if (!ev || ev.target !== this) {
148-
warn(WARNINGS.STATE_CHANGER);
149-
}
150142
});
151143
152-
eventHub.$on('$InfiniteLoading:reset', (ev) => {
144+
eventHub.$on('$InfiniteLoading:reset', () => {
153145
this.status = STATUS.READY;
154146
this.isFirstLoad = true;
155147
scrollBarStorage.remove(this.scrollParent);
@@ -160,10 +152,6 @@ export default /* #__PURE__ */defineComponent({
160152
throttleer.reset();
161153
this.scrollHandler();
162154
}, 1);
163-
164-
if (!ev || ev.target !== this) {
165-
warn(WARNINGS.IDENTIFIER);
166-
}
167155
});
168156
169157
/**

src/config.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,29 +67,7 @@ export const evt3rdArg = (() => {
6767
*/
6868

6969
export const WARNINGS = {
70-
STATE_CHANGER: [
71-
'emit `loaded` and `complete` event through component instance of `$refs` may cause error, so it will be deprecated soon, please use the `$state` argument instead (`$state` just the special `$event` variable):',
72-
'\ntemplate:',
73-
'<infinite-loading @infinite="infiniteHandler"></infinite-loading>',
74-
`
75-
script:
76-
...
77-
infiniteHandler($state) {
78-
ajax('https://www.example.com/api/news')
79-
.then((res) => {
80-
if (res.data.length) {
81-
$state.loaded();
82-
} else {
83-
$state.complete();
84-
}
85-
});
86-
}
87-
...`,
88-
'',
89-
'more details: https://github.com/PeachScript/vue-infinite-loading/issues/57#issuecomment-324370549',
90-
].join('\n'),
9170
INFINITE_EVENT: '`:on-infinite` property will be deprecated soon, please use `@infinite` event instead.',
92-
IDENTIFIER: 'the `reset` event will be deprecated soon, please reset this component by change the `identifier` property.',
9371
};
9472

9573
/**

0 commit comments

Comments
 (0)