File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,22 @@ export default [
9
9
name : 'pubsub' ,
10
10
file : pkg . main
11
11
} ,
12
- plugins : [ buble ( ) ]
12
+ plugins : [
13
+ buble ( {
14
+ objectAssign : 'Object.assign'
15
+ } )
16
+ ]
13
17
} ,
14
18
{
15
19
input : 'src/pubsub.js' ,
16
20
output : {
17
21
format : 'es' ,
18
22
file : pkg . module
19
23
} ,
20
- plugins : [ buble ( ) ]
24
+ plugins : [
25
+ buble ( {
26
+ objectAssign : 'Object.assign'
27
+ } )
28
+ ]
21
29
}
22
30
] ;
Original file line number Diff line number Diff line change 1
1
class pubsub {
2
- constructor ( options = { } ) {
3
- this . options = options ;
2
+ constructor ( options ) {
3
+ this . options = {
4
+ /*
5
+ Enables strict mode (shows more warnings)
6
+ */
7
+ strict : false ,
8
+
9
+ /*
10
+ Accepts a custom logger
11
+ */
12
+ log : false ,
13
+
14
+ ...options
15
+ } ;
4
16
this . _pubsubEvents = { } ;
5
17
this . _pubsubHappened = { } ;
6
18
}
@@ -31,6 +43,11 @@ class pubsub {
31
43
for ( j = 1 ; j < arguments . length ; j ++ ) {
32
44
args . push ( arguments [ j ] ) ;
33
45
}
46
+
47
+ if ( this . options . log ) {
48
+ this . options . log ( event , args ) ;
49
+ }
50
+
34
51
for ( j = 0 , jlen = eventArray . length ; j < jlen ; j ++ ) {
35
52
subscriber = eventArray [ j ] ;
36
53
ret = subscriber [ 0 ] . apply ( subscriber [ 1 ] || this , args ) ;
You can’t perform that action at this time.
0 commit comments