PennController for IBEX › Forums › Support › Exit button › Reply To: Exit button
July 6, 2020 at 6:04 pm
#5756
Jeremy
Keymaster
Hey Nickolas,
I haven’t gotten around to implementing it yet, but I will add this to the next release. In the meantime, here’s a hack:
_AddStandardCommands( function(PennEngine) { this.actions = { pause: function (resolve){ if (this.type=="Timer" && this.running) { this.running = false; this.pausedTimestamp = Date.now(); this.events.push(["Pause","Pause",this.pausedTimestamp,"NULL"]); } resolve(); } , resume: function(resolve){ if (this.type=="Timer" && !this.running && this.pausedTimestamp) { this.resumedTimestamp = Date.now(); const offset = this.resumedTimestamp-this.pausedTimestamp; const newStartTime = this.startTime + offset; this.events.push(["Resume","Resume",this.resumedTimestamp,"NULL"]); this.start(); this.startTime = newStartTime; } resolve(); } } })
This technically adds the pause and resume commands to all PennController elements (that is, those that don’t already have them) but will take effect only with Timer elements. I haven’t tested that things get logged properly though, but be my guest.
Jeremy