( this: Cash, eventFullName: Record<string, EventCallback> | string, selector?: any, data?: any, callback?: EventCallback, _one?: boolean )
| 32 | function on ( this: Cash, eventFullName: string, data: any, callback: EventCallback ): Cash; |
| 33 | function on ( this: Cash, eventFullName: string, selector: string | null | undefined, data: any, callback: EventCallback, _one?: boolean ): Cash; |
| 34 | function on ( this: Cash, eventFullName: Record<string, EventCallback> | string, selector?: any, data?: any, callback?: EventCallback, _one?: boolean ) { |
| 35 | |
| 36 | if ( !isString ( eventFullName ) ) { |
| 37 | |
| 38 | for ( const key in eventFullName ) { |
| 39 | |
| 40 | this.on ( key, selector, data, eventFullName[key], _one ); |
| 41 | |
| 42 | } |
| 43 | |
| 44 | return this; |
| 45 | |
| 46 | } |
| 47 | |
| 48 | if ( !isString ( selector ) ) { |
| 49 | |
| 50 | if ( isUndefined ( selector ) || isNull ( selector ) ) { |
| 51 | |
| 52 | selector = ''; |
| 53 | |
| 54 | } else if ( isUndefined ( data ) ) { |
| 55 | |
| 56 | data = selector; |
| 57 | selector = ''; |
| 58 | |
| 59 | } else { |
| 60 | |
| 61 | callback = data; |
| 62 | data = selector; |
| 63 | selector = ''; |
| 64 | |
| 65 | } |
| 66 | |
| 67 | } |
| 68 | |
| 69 | if ( !isFunction ( callback ) ) { |
| 70 | |
| 71 | callback = data; |
| 72 | data = undefined; |
| 73 | |
| 74 | } |
| 75 | |
| 76 | if ( !callback ) return this; |
| 77 | |
| 78 | each ( getSplitValues ( eventFullName ), ( i, eventFullName ) => { |
| 79 | |
| 80 | const [nameOriginal, namespaces] = parseEventName ( eventFullName ); |
| 81 | const name = getEventNameBubbling ( nameOriginal ); |
| 82 | const isEventHover = ( nameOriginal in eventsHover ); |
| 83 | const isEventFocus = ( nameOriginal in eventsFocus ); |
| 84 | |
| 85 | if ( !name ) return; |
| 86 | |
| 87 | this.each ( ( i, ele ) => { |
| 88 | |
| 89 | if ( !isElement ( ele ) && !isDocument ( ele ) && !isWindow ( ele ) ) return; |
| 90 | |
| 91 | const finalCallback = function ( event: Event ) { |
nothing calls this directly
no test coverage detected