Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanTGold committed Dec 24, 2023
1 parent 437abb3 commit a0e29e3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"lint:fix": "yarn run lint -- --fix",
"prettier": "prettier --write .",
"clean": "rm -rf dist/*",
"precommit": "npm run build:prod && npm run type-check && npm run lint:fix",
"release": "standard-version",
"pushTaggedRelease": "git push --follow-tags --no-verify origin master"
},
Expand Down
6 changes: 2 additions & 4 deletions src/ads/ad-event-type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {PKEventTypes} from '../types';

const AdEventType: PKEventTypes = {
const AdEventType = {
/**
* Fired when the ad can be skip by the user.
*/
Expand Down Expand Up @@ -101,6 +99,6 @@ const AdEventType: PKEventTypes = {
* Fires when browser fails to autoplay an ad.
*/
AD_AUTOPLAY_FAILED: 'adautoplayfailed'
};
} as const;

export {AdEventType};
10 changes: 5 additions & 5 deletions src/event/event-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Utils from '../utils/util';
import {AdEventType} from '../ads/ad-event-type';
import {PKEventTypes} from '../types';

const Html5EventType: PKEventTypes = {
const Html5EventType = {
/**
* Fires when the loading of an audio/video is aborted
*/
Expand Down Expand Up @@ -103,9 +103,9 @@ const Html5EventType: PKEventTypes = {
* Fires when the engine changes presentation mode on safari webkitpresentationmodechanged
*/
PRESENTATION_MODE_CHANGED: 'webkitpresentationmodechanged'
};
} as const;

const CustomEventType: PKEventTypes = {
const CustomEventType = {
/**
* Fires when the media is loaded.
*/
Expand Down Expand Up @@ -268,8 +268,8 @@ const CustomEventType: PKEventTypes = {
* Fired when the source url switched
*/
SOURCE_URL_SWITCHED: 'sourceurlswitched'
};
} as const;

const EventType: PKEventTypes = Utils.Object.merge([Html5EventType, CustomEventType, AdEventType]);
const EventType: PKEventTypes = { ...Html5EventType, ...CustomEventType, ...AdEventType};

export {EventType, Html5EventType, CustomEventType};
6 changes: 2 additions & 4 deletions src/track/track-type.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
const TrackType: {[type: string]: TrackTypes} = Object.freeze({
export const TrackType = {
VIDEO: 'video',
AUDIO: 'audio',
TEXT: 'text',
IMAGE: 'image'
});

export {TrackType};
} as const;

export type TrackTypes = 'video' | 'audio' | 'text' | 'image'
4 changes: 3 additions & 1 deletion src/types/event-types.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export type PKEventTypes = {[event: string]: string};
import { AdEventType, CustomEventType, Html5EventType } from "../playkit";

export type PKEventTypes = typeof Html5EventType & typeof CustomEventType & typeof AdEventType;
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ export * from './track-types'
export * from './video-dimensions'
export * from './video-element-store'
export * from './interfaces'
export * from '../track/track-type'
export * from 'js-logger';

0 comments on commit a0e29e3

Please sign in to comment.