File tree 3 files changed +8
-9
lines changed
3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @egamagz/paska-ovo" ,
3
- "version" : " 1.0.6 " ,
3
+ "version" : " 1.0.7 " ,
4
4
"exports" : " ./mod.ts" ,
5
5
"lock" : false ,
6
6
"compilerOptions" : {
Original file line number Diff line number Diff line change 7
7
8
8
import type { Callback , EasterEgg , EasterEggState } from "./types.ts" ;
9
9
import { codeToChars } from "./util/code.ts" ;
10
+ import { DEFAULT_DURATION } from "./util/constants.ts" ;
10
11
import { isInputElement } from "./util/dom.ts" ;
11
12
12
13
/**
@@ -162,14 +163,10 @@ export class PaskaOvo {
162
163
this . callbacks . forEach ( ( callback ) => callback ( easterEgg ) ) ;
163
164
164
165
if ( easterEgg . onFinish ) {
165
- if ( easterEgg . duration ) {
166
- setTimeout (
167
- easterEgg . onFinish ,
168
- easterEgg . duration ,
169
- ) ;
170
- } else {
171
- easterEgg . onFinish ( ) ;
172
- }
166
+ setTimeout (
167
+ easterEgg . onFinish ,
168
+ easterEgg . duration || DEFAULT_DURATION ,
169
+ ) ;
173
170
}
174
171
} catch ( error ) {
175
172
console . error ( `Error executing easter egg ${ easterEgg . tag } :` , error ) ;
Original file line number Diff line number Diff line change @@ -30,3 +30,5 @@ export const INPUT_ELEMENTS = [
30
30
"input" ,
31
31
"select" ,
32
32
] ;
33
+
34
+ export const DEFAULT_DURATION = 1_000 ;
You can’t perform that action at this time.
0 commit comments