Skip to content

Commit

Permalink
Merge pull request #14 from tcavenezuela/feature/new-methods-return-f…
Browse files Browse the repository at this point in the history
…or-schedule

feat: Add start and stop return methods for schedule function.
  • Loading branch information
carl0shd committed Feb 18, 2024
2 parents aa16348 + e96ecc1 commit 846333b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-bears-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@simconnect.js/api': patch
---

Add start and stop return methods for schedule function
8 changes: 4 additions & 4 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@ export class SIMCONNECT_API {
if (running) setTimeout(run, interval);
};
run();
return [
() => {
return {
start: () => {
running = true;
run();
},
() => (running = false)
];
stop: () => (running = false)
};
}
}

0 comments on commit 846333b

Please sign in to comment.