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

refactor: convert js to ts #6

Merged
merged 6 commits into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
222 changes: 79 additions & 143 deletions examples/react/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "",
"license": "MIT",
"dependencies": {
"@telnyx/webrtc": "1.0.0"
"@telnyx/webrtc": "1.0.4"
},
"devDependencies": {
"@babel/core": "^7.6.2",
Expand Down
41 changes: 30 additions & 11 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/TelnyxRTC/ConfMan.js → src/TelnyxRTC/ConfMan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ let CONFMAN_SERNO = 0;
* @hidden
*/
export default class VertoConfMan {
public params: any;
public verto: any;
public serno: any;
public canvasCount: any;
public destroyed: any;

constructor(verto, params) {
this.params = Object.assign(
{
Expand Down Expand Up @@ -101,7 +107,7 @@ export default class VertoConfMan {
// if (this.params.laData.role === "moderator")
}

modCommand(cmd, id, value) {
modCommand(cmd, id, value?) {
this.verto.call(`${this.verto.module}.broadcast`, {
eventChannel: this.params.laData.modChannel,
data: {
Expand Down
34 changes: 29 additions & 5 deletions src/TelnyxRTC/Dialog.js → src/TelnyxRTC/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@ import Enum from './Enum';
* @hidden
*/
export default class VertoDialog {
public params: any;
public verto: any;
public direction: any;
public lastState: any;
public state: any;
public callbacks: any;
public answered: any;
public attach: any;
public screenShare: any;
public useCamera: any;
public useMic: any;
public useSpeak: any;
public onStateChange: any;
public rtc: any;
public callID: any;
public audioStream: any;
public videoStream: any;
public localVideo: any;
public setAudioPlaybackDevice: any;
public causeCode: any;
public cause: any;
public gotAnswer: any;
public gotEarly: any;

constructor(direction, verto, params) {
this.params = Object.assign(
{
Expand Down Expand Up @@ -92,7 +116,7 @@ export default class VertoDialog {

this.verto.dialogs[this.callID] = this;

const RTCcallbacks = {};
const RTCcallbacks: any = {};

if (this.direction == Enum.direction.inbound) {
if (this.params.display_direction === 'outbound') {
Expand Down Expand Up @@ -272,7 +296,7 @@ export default class VertoDialog {
}
})
.catch((error) => {
const errorMessage = error;
let errorMessage = error;
if (error.name === 'SecurityError') {
errorMessage =
'Dialog: ' +
Expand Down Expand Up @@ -438,7 +462,7 @@ export default class VertoDialog {
}
}

hangup(params) {
hangup(params?) {
if (params) {
if (params.causeCode) {
this.causeCode = params.causeCode;
Expand Down Expand Up @@ -541,7 +565,7 @@ export default class VertoDialog {
}

rtt(obj) {
const pobj = {};
const pobj: any = {};

if (!obj) {
return false;
Expand Down Expand Up @@ -615,7 +639,7 @@ export default class VertoDialog {
return true;
}

answer(params) {
answer(params?) {
if (this.answered) return;

if (!params) params = {};
Expand Down
Loading