-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
preventing service toggle on start/stop spam
- Loading branch information
1 parent
30f97aa
commit a06e041
Showing
7 changed files
with
58 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {Azure} from './azure'; | ||
|
||
// This is a mechanism used to prevent two azure services starting at once as it cannot actually be stopped when connecting | ||
// however if it does not connect in 800 milliseconds, the user has an option to start a new connection | ||
export class PreventConnectionStop { | ||
public static applyPrevention(azure: Azure) { | ||
clearTimeout(azure._manualConnectionStopPrevention); | ||
azure.cannotBeStopped = true; | ||
azure._manualConnectionStopPrevention = setTimeout(() => { | ||
azure.cannotBeStopped = false; | ||
}, 800); | ||
} | ||
|
||
public static clearPrevention(azure: Azure) { | ||
clearTimeout(azure._manualConnectionStopPrevention); | ||
azure.cannotBeStopped = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Speech} from '../speech'; | ||
|
||
export class GlobalState { | ||
public static service: Speech | undefined; | ||
private static doubleClickPending = false; | ||
|
||
public static doubleClickDetector() { | ||
if (GlobalState.doubleClickPending) return true; | ||
GlobalState.doubleClickPending = true; | ||
setTimeout(() => { | ||
GlobalState.doubleClickPending = false; | ||
}, 300); | ||
return false; | ||
} | ||
} |