aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/interval_utils.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-30 20:26:46 +0800
committerFabio Berger <me@fabioberger.com>2018-01-30 20:26:46 +0800
commitc6dece6bd1e5f5afa56b290557eb7a6245c76cb6 (patch)
treead7a33ffe5d80c0eb41ae10fbc8314f193e52383 /packages/utils/src/interval_utils.ts
parent93a5b3f457c1211676296840c285759007a55500 (diff)
downloaddexon-0x-contracts-c6dece6bd1e5f5afa56b290557eb7a6245c76cb6.tar.gz
dexon-0x-contracts-c6dece6bd1e5f5afa56b290557eb7a6245c76cb6.tar.zst
dexon-0x-contracts-c6dece6bd1e5f5afa56b290557eb7a6245c76cb6.zip
Add config file specifically in prettier command and fix files
Diffstat (limited to 'packages/utils/src/interval_utils.ts')
-rw-r--r--packages/utils/src/interval_utils.ts66
1 files changed, 33 insertions, 33 deletions
diff --git a/packages/utils/src/interval_utils.ts b/packages/utils/src/interval_utils.ts
index 65e51677b..ebecc7015 100644
--- a/packages/utils/src/interval_utils.ts
+++ b/packages/utils/src/interval_utils.ts
@@ -1,37 +1,37 @@
import * as _ from 'lodash';
export const intervalUtils = {
- setAsyncExcludingInterval(fn: () => Promise<void>, intervalMs: number, onError: (err: Error) => void) {
- let locked = false;
- const intervalId = setInterval(async () => {
- if (locked) {
- return;
- } else {
- locked = true;
- try {
- await fn();
- } catch (err) {
- onError(err);
- }
- locked = false;
- }
- }, intervalMs);
- return intervalId;
- },
- clearAsyncExcludingInterval(intervalId: NodeJS.Timer): void {
- clearInterval(intervalId);
- },
- setInterval(fn: () => void, intervalMs: number, onError: (err: Error) => void) {
- const intervalId = setInterval(() => {
- try {
- fn();
- } catch (err) {
- onError(err);
- }
- }, intervalMs);
- return intervalId;
- },
- clearInterval(intervalId: NodeJS.Timer): void {
- clearInterval(intervalId);
- },
+ setAsyncExcludingInterval(fn: () => Promise<void>, intervalMs: number, onError: (err: Error) => void) {
+ let locked = false;
+ const intervalId = setInterval(async () => {
+ if (locked) {
+ return;
+ } else {
+ locked = true;
+ try {
+ await fn();
+ } catch (err) {
+ onError(err);
+ }
+ locked = false;
+ }
+ }, intervalMs);
+ return intervalId;
+ },
+ clearAsyncExcludingInterval(intervalId: NodeJS.Timer): void {
+ clearInterval(intervalId);
+ },
+ setInterval(fn: () => void, intervalMs: number, onError: (err: Error) => void) {
+ const intervalId = setInterval(() => {
+ try {
+ fn();
+ } catch (err) {
+ onError(err);
+ }
+ }, intervalMs);
+ return intervalId;
+ },
+ clearInterval(intervalId: NodeJS.Timer): void {
+ clearInterval(intervalId);
+ },
};