11import Vue from 'vue'
22import type { PropType , CreateElement , VNode } from 'vue'
3+ import type { WithEvents } from 'vue-typed-emit'
34import type { WithRefs } from 'vue-typed-refs'
45
5- import type {
6- LoadIframeEventPayload ,
7- InitPlayerEventPayload ,
8- Refs ,
9- Thumbnail ,
10- } from './types'
6+ import type { Events , Refs , Thumbnail } from './types'
117import { startsWith , isAspectRatio } from './helpers'
128import {
139 DEFAULT_ALT_ATTRIBUTE ,
@@ -22,7 +18,7 @@ import {
2218} from './constants'
2319import { Event } from './event'
2420
25- export default ( Vue as WithRefs < Refs > ) . extend ( {
21+ export default ( Vue as WithRefs < Refs , WithEvents < Events > > ) . extend ( {
2622 name : 'VueLazyYoutubeVideo' ,
2723 props : {
2824 src : {
@@ -135,8 +131,7 @@ export default (Vue as WithRefs<Refs>).extend({
135131 return `${ ( b / a ) * 100 } %`
136132 } ,
137133 onIframeLoad ( ) {
138- const payload : LoadIframeEventPayload = { iframe : this . $refs . iframe }
139- this . $emit ( Event . LOAD_IFRAME , payload )
134+ this . $emit ( Event . LOAD_IFRAME , { iframe : this . $refs . iframe } )
140135
141136 if ( this . enablejsapi ) {
142137 try {
@@ -173,8 +168,7 @@ export default (Vue as WithRefs<Refs>).extend({
173168 '[vue-lazy-youtube-video]: YT.Player can not be instantiated without iframe element'
174169 )
175170 this . playerInstance = new YT . Player ( iframe , this . playerOptions )
176- const payload : InitPlayerEventPayload = { instance : this . playerInstance }
177- this . $emit ( Event . INIT_PLAYER , payload )
171+ this . $emit ( Event . INIT_PLAYER , { instance : this . playerInstance } )
178172 return this . playerInstance
179173 } ,
180174 getPlayerInstance ( ) {
0 commit comments