@@ -41,9 +41,9 @@ type position = 'top-right' | 'top' | 'top-left' | 'bottom-right' | 'bottom' | '
41
41
42
42
const removeElement = (el ) => {
43
43
if (typeof el .remove !== ' undefined' ) {
44
- el .remove ()
44
+ el .remove ();
45
45
} else {
46
- el .parentNode .removeChild (el )
46
+ el .parentNode .removeChild (el );
47
47
}
48
48
};
49
49
@@ -97,18 +97,12 @@ export default class PToast extends Vue {
97
97
/**
98
98
* Do something when user clicks
99
99
*/
100
- @Prop ({
101
- type: Function , default : () => {
102
- }
103
- }) public onClick! : any ;
100
+ @Prop ({ type: Function , default: ({})}) public onClick! : any ;
104
101
105
102
/**
106
103
* Do something after toast gets dismissed
107
104
*/
108
- @Prop ({
109
- type: Function , default : () => {
110
- }
111
- }) public onDismiss! : any ;
105
+ @Prop ({type: Function , default: ({})}) public onDismiss! : any ;
112
106
113
107
public isActive = false ;
114
108
public parentTop: any = null ;
@@ -125,8 +119,8 @@ export default class PToast extends Vue {
125
119
eventBus .on (' toast-clear' , this .dismiss );
126
120
}
127
121
128
- beforeDestroy() {
129
- eventBus .off (' toast-clear' , this .dismiss )
122
+ public beforeDestroy() {
123
+ eventBus .off (' toast-clear' , this .dismiss );
130
124
}
131
125
132
126
public setupContainer() {
@@ -156,7 +150,7 @@ export default class PToast extends Vue {
156
150
if (this .shouldQueue ()) {
157
151
// Call recursively if should queue
158
152
this .queueTimer = setTimeout (this .showNotice , 250 );
159
- return
153
+ return ;
160
154
}
161
155
this .correctParent .insertAdjacentElement (' afterbegin' , this .$el );
162
156
this .isActive = true ;
@@ -167,34 +161,34 @@ export default class PToast extends Vue {
167
161
}
168
162
169
163
public shouldQueue() {
170
- if (! this .queue ) return false ;
164
+ if (! this .queue ) { return false ; }
171
165
172
166
return (
173
167
this .parentTop .childElementCount > 0 ||
174
168
this .parentBottom .childElementCount > 0
175
- )
169
+ );
176
170
}
177
171
178
172
public dismiss() {
179
- if (this .timer ) this .timer .stop ();
173
+ if (this .timer ) { this .timer .stop (); }
180
174
clearTimeout (this .queueTimer );
181
175
this .isActive = false ;
182
176
183
177
// Timeout for the animation complete before destroying
184
178
setTimeout (() => {
185
179
this .onDismiss .apply (null , arguments );
186
180
this .$destroy ();
187
- removeElement (this .$el )
188
- }, 150 )
181
+ removeElement (this .$el );
182
+ }, 150 );
189
183
}
190
184
191
185
public toggleTimer(newVal ) {
192
- if (! this .pauseOnHover || ! this .timer ) return ;
186
+ if (! this .pauseOnHover || ! this .timer ) { return ; }
193
187
newVal ? this .timer .pause () : this .timer .resume ();
194
188
}
195
189
196
190
public whenClicked() {
197
- if (! this .dismissible ) return ;
191
+ if (! this .dismissible ) { return ; }
198
192
this .onClick .apply (null , arguments );
199
193
this .dismiss ();
200
194
}
@@ -222,15 +216,15 @@ export default class PToast extends Vue {
222
216
case Positions .TOP_LEFT :
223
217
return {
224
218
enter: ' Polaris-Frame-Toast-Fade-In-Down' ,
225
- leave: ' Polaris-Frame-Toast-Fade-Out'
219
+ leave: ' Polaris-Frame-Toast-Fade-Out' ,
226
220
};
227
221
228
222
case Positions .BOTTOM :
229
223
case Positions .BOTTOM_RIGHT :
230
224
case Positions .BOTTOM_LEFT :
231
225
return {
232
226
enter: ' Polaris-Frame-Toast-Fade-In-Up' ,
233
- leave: ' Polaris-Frame-Toast-Fade-Out'
227
+ leave: ' Polaris-Frame-Toast-Fade-Out' ,
234
228
};
235
229
}
236
230
}
0 commit comments