File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
src/com/react-dynamic-tabs/utils/api Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 1+ import helper from '../helper.js' ;
12const Pub_Sub = function ( ) {
23 this . _publishers = {
3- beforeSwitchTab : [ ]
4- , onChange : [ ]
4+ onChange : [ ]
55 , onLoad : [ ]
66 , onDestroy : [ ]
77 , onOpen : [ ]
88 , onClose : [ ]
99 , onSelect : [ ]
10+ , beforeSelect : [ ]
11+ , beforeClose : [ ]
12+ , onInit : [ ]
13+ , onFirstSelect : [ ]
1014 } ;
1115} ;
1216//unSubscribe
@@ -34,13 +38,15 @@ Pub_Sub.prototype.one = function (publisherName, fn) {
3438 }
3539 return this ;
3640} ;
37- Pub_Sub . prototype . trigger = function ( publisherName , param , context ) {
38- if ( this . _publishers . hasOwnProperty ( publisherName ) ) {
41+ helper . setNoneEnumProps ( Pub_Sub . prototype , {
42+ trigger : function ( publisherName , context , ...param ) {
43+ context = context || null ;
44+ const result = [ ] ;
3945 const _subscribers = [ ...this . _publishers [ publisherName ] ] ;
4046 _subscribers . map ( subscriber => {
41- context ? subscriber . call ( context , param ) : subscriber ( param ) ;
47+ result . push ( subscriber . apply ( context , param ) ) ;
4248 } ) ;
49+ return result ;
4350 }
44- return this ;
45- } ;
51+ } ) ;
4652export default Pub_Sub ;
You can’t perform that action at this time.
0 commit comments