Skip to content

Commit

Permalink
Types
Browse files Browse the repository at this point in the history
  • Loading branch information
pierophp committed Aug 22, 2023
1 parent 75cc404 commit 9d7b46e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
26 changes: 13 additions & 13 deletions dist/index.d.ts/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ type Status =
handlers: any;
};

export class EasySpeech {
public init(request: {
export default class EasySpeech {
public static init(request: {
maxTimeout: number;
interval: number;
quiet: boolean;
quiet?: boolean;
}): Promise<boolean>;

public detect(): {
public static detect(): {
speechSynthesis: SpeechSynthesis | undefined;
speechSynthesisUtterance: SpeechSynthesisUtterance | undefined;
speechSynthesisVoice: SpeechSynthesisVoice | undefined;
Expand All @@ -41,11 +41,11 @@ export class EasySpeech {
onstart: boolean;
};

public status(): Status;
public static status(): Status;

public voices(): SpeechSynthesisVoice[];
public static voices(): SpeechSynthesisVoice[];

public on(handlers: {
public static on(handlers: {
boundary?: (event: SpeechSynthesisEvent) => void;
end?: (event: SpeechSynthesisEvent) => void;
mark?: (event: SpeechSynthesisEvent) => void;
Expand All @@ -55,7 +55,7 @@ export class EasySpeech {
error?: (event: SpeechSynthesisErrorEvent) => void;
}): SpeechSynthesisVoice[];

public defaults(options: {
public static defaults(options: {
voice?: SpeechSynthesisVoice;
pitch?: number;
rate?: number;
Expand All @@ -67,7 +67,7 @@ export class EasySpeech {
voice: null | SpeechSynthesisVoice;
};

public speak(options: {
public static speak(options: {
text: string;
voice?: SpeechSynthesisVoice;
pitch?: number;
Expand All @@ -84,11 +84,11 @@ export class EasySpeech {
error?: (event: SpeechSynthesisErrorEvent) => void;
}): Promise<any>;

public cancel(): void;
public static cancel(): void;

public resume(): void;
public static resume(): void;

public pause(): void;
public static pause(): void;

public reset(): void;
public static reset(): void;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"main": "dist/EasySpeech.cjs.js",
"browser": "dist/EasySpeech.iife.js",
"exports": "./dist/EasySpeech.js",
"exports": "./dist/index.d.ts",
"scripts": {
"test": "NODE_ENV=test ./node_modules/.bin/mocha 'tests/**/*.tests.js'",
"test-debug": "NODE_ENV=test ./node_modules/.bin/mocha --inspect --debug-brk 'tests/**/*.tests.js'",
Expand Down
26 changes: 13 additions & 13 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ type Status =
handlers: any;
};

export class EasySpeech {
public init(request: {
export default class EasySpeech {
public static init(request: {
maxTimeout: number;
interval: number;
quiet: boolean;
quiet?: boolean;
}): Promise<boolean>;

public detect(): {
public static detect(): {
speechSynthesis: SpeechSynthesis | undefined;
speechSynthesisUtterance: SpeechSynthesisUtterance | undefined;
speechSynthesisVoice: SpeechSynthesisVoice | undefined;
Expand All @@ -41,11 +41,11 @@ export class EasySpeech {
onstart: boolean;
};

public status(): Status;
public static status(): Status;

public voices(): SpeechSynthesisVoice[];
public static voices(): SpeechSynthesisVoice[];

public on(handlers: {
public static on(handlers: {
boundary?: (event: SpeechSynthesisEvent) => void;
end?: (event: SpeechSynthesisEvent) => void;
mark?: (event: SpeechSynthesisEvent) => void;
Expand All @@ -55,7 +55,7 @@ export class EasySpeech {
error?: (event: SpeechSynthesisErrorEvent) => void;
}): SpeechSynthesisVoice[];

public defaults(options: {
public static defaults(options: {
voice?: SpeechSynthesisVoice;
pitch?: number;
rate?: number;
Expand All @@ -67,7 +67,7 @@ export class EasySpeech {
voice: null | SpeechSynthesisVoice;
};

public speak(options: {
public static speak(options: {
text: string;
voice?: SpeechSynthesisVoice;
pitch?: number;
Expand All @@ -84,11 +84,11 @@ export class EasySpeech {
error?: (event: SpeechSynthesisErrorEvent) => void;
}): Promise<any>;

public cancel(): void;
public static cancel(): void;

public resume(): void;
public static resume(): void;

public pause(): void;
public static pause(): void;

public reset(): void;
public static reset(): void;
}

0 comments on commit 9d7b46e

Please sign in to comment.