diff options
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r-- | client/src/app/shared/misc/utils.ts | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts index 64bc69b0d..d520b1a7b 100644 --- a/client/src/app/shared/misc/utils.ts +++ b/client/src/app/shared/misc/utils.ts | |||
@@ -59,14 +59,6 @@ function immutableAssign <A, B> (target: A, source: B) { | |||
59 | return Object.assign({}, target, source) | 59 | return Object.assign({}, target, source) |
60 | } | 60 | } |
61 | 61 | ||
62 | function isInSmallView () { | ||
63 | return window.innerWidth < 600 | ||
64 | } | ||
65 | |||
66 | function isInMobileView () { | ||
67 | return window.innerWidth < 500 | ||
68 | } | ||
69 | |||
70 | // Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34 | 62 | // Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34 |
71 | function objectToFormData (obj: any, form?: FormData, namespace?: string) { | 63 | function objectToFormData (obj: any, form?: FormData, namespace?: string) { |
72 | let fd = form || new FormData() | 64 | let fd = form || new FormData() |
@@ -94,6 +86,18 @@ function lineFeedToHtml (obj: object, keyToNormalize: string) { | |||
94 | }) | 86 | }) |
95 | } | 87 | } |
96 | 88 | ||
89 | // Try to cache a little bit window.innerWidth | ||
90 | let windowInnerWidth = window.innerWidth | ||
91 | setInterval(() => windowInnerWidth = window.innerWidth, 500) | ||
92 | |||
93 | function isInSmallView () { | ||
94 | return windowInnerWidth < 600 | ||
95 | } | ||
96 | |||
97 | function isInMobileView () { | ||
98 | return windowInnerWidth < 500 | ||
99 | } | ||
100 | |||
97 | export { | 101 | export { |
98 | viewportHeight, | 102 | viewportHeight, |
99 | getParameterByName, | 103 | getParameterByName, |