aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/misc
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r--client/src/app/shared/misc/utils.ts20
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
62function isInSmallView () {
63 return window.innerWidth < 600
64}
65
66function isInMobileView () {
67 return window.innerWidth < 500
68}
69
70// Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34 62// Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34
71function objectToFormData (obj: any, form?: FormData, namespace?: string) { 63function 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
90let windowInnerWidth = window.innerWidth
91setInterval(() => windowInnerWidth = window.innerWidth, 500)
92
93function isInSmallView () {
94 return windowInnerWidth < 600
95}
96
97function isInMobileView () {
98 return windowInnerWidth < 500
99}
100
97export { 101export {
98 viewportHeight, 102 viewportHeight,
99 getParameterByName, 103 getParameterByName,