Skip to content

Commit

Permalink
fix(Idle): do not pause interrupts when idle
Browse files Browse the repository at this point in the history
Interrupts should only be paused on timeout so user activity can automatically reset idle state

Fixes #4 and #5
  • Loading branch information
Paul Ryan authored and grbsk committed Apr 6, 2016
1 parent f5fca45 commit d8d600d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/idle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,19 @@ export function main() {
expect(source.isAttached).toBe(false);
});

it('watch() should attach all interrupts when resuming after idle',
it('watch() should attach all interrupts when resuming after timeout',
<any>fakeAsync((): void => {
let source = new MockInterruptSource();

instance.setTimeout(3);
instance.setInterrupts([source]);
instance.watch();

expect(source.isAttached).toBe(true);

tick(3000);
tick(6000);

expect(instance.isIdling()).toBe(true);
expect(source.isAttached).toBe(false);

instance.watch();
Expand Down Expand Up @@ -245,7 +247,7 @@ export function main() {
expect(instance.isIdling()).toBe(false);
}));

it('should pause interrupts when idle', <any>fakeAsync((): void => {
it('should NOT pause interrupts when idle', <any>fakeAsync((): void => {
let source = new MockInterruptSource();

instance.setInterrupts([source]);
Expand All @@ -255,7 +257,7 @@ export function main() {

expect(instance.isIdling()).toBe(true);

expect(source.isAttached).toBe(false);
expect(source.isAttached).toBe(true);

instance.stop();
}));
Expand Down
1 change: 0 additions & 1 deletion src/idle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ export class Idle implements OnDestroy {
this.idling = !this.idling;

if (this.idling) {
this.toggleInterrupts(false);
this.onIdleStart.emit(null);
this.stopKeepalive();

Expand Down

0 comments on commit d8d600d

Please sign in to comment.