Skip to content

Commit

Permalink
fix: pr review
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardz committed Apr 25, 2022
1 parent f8bb4f8 commit 79588bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/resize.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { device } from '@jam3/detect';

import { resizeDebounceTime } from '@/data/settings';

type ResizeListener = (e?: Event | UIEvent) => void;

let timeout: NodeJS.Timeout;
class Service {
debounceTime = 10; // in ms
listeners: ResizeListener[] = [];

onResize = (e: Event | UIEvent) => {
Expand All @@ -17,7 +18,7 @@ class Service {
this.listeners.forEach((listener) => listener(e));
}, 500); // some mobile browsers only update window dimensions when the rotate animation finishes
}
}, this.debounceTime);
}, resizeDebounceTime);
};

listen = (listener: ResizeListener) => {
Expand Down

0 comments on commit 79588bd

Please sign in to comment.