Skip to content

Commit

Permalink
Add the possibility to reset the counter by holding the key for 1.5s
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Colucci committed Mar 14, 2019
1 parent f7c19f9 commit adb2623
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Binary file modified Release/com.elgato.counter.streamDeckPlugin
Binary file not shown.
12 changes: 12 additions & 0 deletions Sources/com.elgato.counter.sdPlugin/code.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,27 @@

var DestinationEnum = Object.freeze({"HARDWARE_AND_SOFTWARE":0, "HARDWARE_ONLY":1, "SOFTWARE_ONLY":2})

var timer;

var counterAction = {

type : "com.elgato.counter.action",

onKeyDown : function(context, settings, coordinates, userDesiredState) {

timer = setTimeout(function () {
var updatedSettings = {};
updatedSettings["keyPressCounter"] = -1;

counterAction.SetSettings(context, updatedSettings);
counterAction.SetTitle(context, 0);
},1500);
},

onKeyUp : function(context, settings, coordinates, userDesiredState) {

clearTimeout(timer);

var keyPressCounter = 0;
if(settings != null && settings.hasOwnProperty('keyPressCounter')){
keyPressCounter = settings["keyPressCounter"];
Expand Down
2 changes: 1 addition & 1 deletion Sources/com.elgato.counter.sdPlugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"Name": "Counter",
"Icon": "pluginIcon",
"URL": "https://www.elgato.com/gaming/stream-deck",
"Version": "1.2",
"Version": "1.3",
"OS": [
{
"Platform": "mac",
Expand Down

0 comments on commit adb2623

Please sign in to comment.