Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/enhance typings #2518

Merged
merged 5 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions npm/janus.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
declare namespace JanusJS {
interface Dependencies {
adapter: any;
adapter: import('webrtc-adapter').IAdapter;
WebSocket: (server: string, protocol: string) => WebSocket;
isArray: (array: any) => array is Array<any>;
extension: () => boolean;
httpAPICall: (url: string, options: any) => void;
}
interface DependenciesResult {
}

interface DependenciesResult {
adapter: any;
newWebSocket: (server: string, protocol: string) => WebSocket;
isArray: (array: any) => array is Array<any>;
Expand All @@ -20,7 +20,7 @@ declare namespace JanusJS {
Debug = 'debug',
Log = 'log',
Warning = 'warn',
Error = 'error'
Error = 'error',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add a comma here? It's the last item in the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier did it for me( sorry, I'll fix

}

interface JSEP {}
Expand Down Expand Up @@ -52,7 +52,7 @@ declare namespace JanusJS {
Stopped = 'stopped',
SlowLink = 'slow_link',
Preparing = 'preparing',
Refreshing = 'refreshing'
Refreshing = 'refreshing',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

}

interface Message {
Expand Down Expand Up @@ -127,6 +127,9 @@ declare namespace JanusJS {
handleRemoteJsep(params: { jsep: JSEP }): void;
dtmf(params: any): void;
data(params: any): void;
isAudioMuted(): boolean;
muteAudio(): void;
unmuteAudio(): void;
Comment on lines +130 to +132
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reason why this pr was created. And I also noticed that adapter has any type and I thought it's ok to get actual types from webrtc-adapter.

isVideoMuted(): boolean;
muteVideo(): void;
unmuteVideo(): void;
Expand Down
3 changes: 2 additions & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"devDependencies": {
"rollup": "^0.50.0",
"rollup-plugin-replace": "^2.0.0"
"rollup-plugin-replace": "^2.0.0",
"webrtc-adapter": "^7.7.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While 7.7.0 is indeed the latest version, the demos still only ship 7.4.0, as that's the latest you can find on cdnjs. Not sure if this is meant for server-side usage of janus.js, or for embedding in other frameworks, but maybe it would be best to stick to 7.4.0 here too? (unless this dependency downloads the right version independently of what the web page does).

}
}