diff --git a/packages/utils/event.ts b/packages/utils/event.ts index b980ffedf..44fbd15b0 100644 --- a/packages/utils/event.ts +++ b/packages/utils/event.ts @@ -1,7 +1,7 @@ /* eslint-disable no-empty */ /* eslint-disable getter-return */ /* eslint-disable import/no-mutable-exports */ -import { noop, isServer } from '.'; +import { isServer } from '.'; type EventHanlder = (event?: Event) => void; @@ -16,18 +16,29 @@ if (!isServer) { supportsPassive = true; } }); - window.addEventListener('test-passive', noop, opts); + window.addEventListener('test-passive', null as any, opts); } catch (e) {} } -export function on(target: HTMLElement, event: string, handler: EventHanlder, passive = false) { +export function on( + target: HTMLElement, + event: string, + handler: EventHanlder, + passive = false +) { if (!isServer) { - target.addEventListener(event, handler, supportsPassive ? { capture: false, passive } : false); + target.addEventListener( + event, + handler, + supportsPassive ? { capture: false, passive } : false + ); } } export function off(target: HTMLElement, event: string, handler: EventHanlder) { - !isServer && target.removeEventListener(event, handler); + if (!isServer) { + target.removeEventListener(event, handler); + } } export function stop(event: Event) { diff --git a/packages/utils/raf.ts b/packages/utils/raf.ts index 758c34440..80558d91f 100644 --- a/packages/utils/raf.ts +++ b/packages/utils/raf.ts @@ -19,10 +19,10 @@ function fallback(fn: FrameRequestCallback): number { const root = (isServer ? global : window); /* istanbul ignore next */ -const iRaf = root.requestAnimationFrame || root.webkitRequestAnimationFrame || fallback; +const iRaf = root.requestAnimationFrame || fallback; /* istanbul ignore next */ -const iCancel = root.cancelAnimationFrame || root.webkitCancelAnimationFrame || root.clearTimeout; +const iCancel = root.cancelAnimationFrame || root.clearTimeout; export function raf(fn: FrameRequestCallback): number { return iRaf.call(root, fn); diff --git a/packages/utils/use/sfc.ts b/packages/utils/use/sfc.ts index 7adee5286..31ae5a381 100644 --- a/packages/utils/use/sfc.ts +++ b/packages/utils/use/sfc.ts @@ -85,10 +85,8 @@ function defaultProps(props: any) { function install(this: ComponentOptions, Vue: VueConstructor) { const { name } = this; - if (name) { - Vue.component(name, this); - Vue.component(camelize(`-${name}`), this); - } + Vue.component(name as string, this); + Vue.component(camelize(`-${name}`), this); } // unify slots & scopedSlots