Skip to content

Commit

Permalink
feat(runtime): better typing declarations in the patchEvent() feature
Browse files Browse the repository at this point in the history
  • Loading branch information
msaelices committed Mar 24, 2020
1 parent 1f2148a commit b68f169
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/runtime/src/modules/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function addEventListener(
el: INSVElement,
event: string,
handler: EventListener,
options?: EventListenerOptions
options: EventListenerOptions = {}
) {
el.addEventListener(event, handler, options)
}
Expand Down
12 changes: 10 additions & 2 deletions packages/runtime/src/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ export interface INSVElement extends INSVNode {
meta: NSVViewMeta
style: Style | string

addEventListener(event: string, handler: any, options?: any): void
addEventListener(
event: string,
handler: any,
options: AddEventListenerOptions
): void

removeEventListener(event: string, handler?: any): void

Expand Down Expand Up @@ -138,7 +142,11 @@ export class NSVElement extends NSVNode implements INSVElement {
return (this._meta = getViewMeta(this.tagName))
}

addEventListener(event: string, handler: any, options: any = {}) {
addEventListener(
event: string,
handler: any,
options: AddEventListenerOptions = {}
) {
const { capture, once } = options
if (capture) {
console.log('Bubble propagation is not supported')
Expand Down

0 comments on commit b68f169

Please sign in to comment.