- added return type to Vibrator.loop and IVibrator.loop.

- updated version.
This commit is contained in:
Eugene Serb 2022-08-28 13:05:42 +03:00
parent a66df1331a
commit fad050f550
3 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
"name": "wavelovers", "name": "wavelovers",
"description": "Wavelovers. Use your device vibration correctly. Make a massager out of a gamepad.", "description": "Wavelovers. Use your device vibration correctly. Make a massager out of a gamepad.",
"keywords": [ "wavelovers", "gamepad-vibrator", "gamepad-test-tool", "gamepad-vibration-test-tool" ], "keywords": [ "wavelovers", "gamepad-vibrator", "gamepad-test-tool", "gamepad-vibration-test-tool" ],
"version": "1.0.2", "version": "1.0.3",
"license": "GNU GPL v3", "license": "GNU GPL v3",
"homepage": "https://wavelovers.ru/", "homepage": "https://wavelovers.ru/",
"author": { "author": {

View File

@ -8,7 +8,7 @@ interface IVibrator {
isVibrating: boolean; isVibrating: boolean;
interval: number; interval: number;
update(): void; update(): void;
loop(pattern: TPatternUnit[]): void; loop(pattern: TPatternUnit[]): Promise<void>;
vibrate(pattern: TPatternUnit): void; vibrate(pattern: TPatternUnit): void;
reset(): void; reset(): void;
sleep(ms: number): Promise<number>; sleep(ms: number): Promise<number>;

View File

@ -24,7 +24,7 @@ class Vibrator implements IVibrator {
this.unit = gamepads[this.unit.index] as unknown as IGamepad; this.unit = gamepads[this.unit.index] as unknown as IGamepad;
} }
async loop(pattern: TPatternUnit[]) { async loop(pattern: TPatternUnit[]): Promise<void> {
this.isVibrating = true; this.isVibrating = true;
const offsetTime = 10; const offsetTime = 10;
while (this.isVibrating === true) { while (this.isVibrating === true) {