Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: migrate dimensions.js to typescript (#2153)

Abdulrehman-Jafer159b6f3ca612
diff --git a/apps/web/src/utils/dimensions.js b/apps/web/src/utils/dimensions.ts
similarity index 67%
rename from apps/web/src/utils/dimensions.js
rename to apps/web/src/utils/dimensions.ts
index 0e43758b5..2a94ae044 100644
--- a/apps/web/src/utils/dimensions.js
+++ b/apps/web/src/utils/dimensions.ts
@@ -17,22 +17,13 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-function isMobile() {
- var match = window.matchMedia || window.msMatchMedia;
- if (match) {
- var mq = match("(max-width: 480px)");
- return mq.matches;
- }
- return false;
+function isMobile(): boolean {
+ return window.matchMedia("(max-width: 480px)").matches;
}
-function isTablet() {
- var match = window.matchMedia || window.msMatchMedia;
- if (match) {
- var mq = match("(min-width: 480px) and (max-width: 1000px)");
- return mq.matches;
- }
- return false;
+function isTablet(): boolean {
+ return window.matchMedia("(min-width: 480px) and (max-width: 1000px)")
+ .matches;
}
export { isMobile, isTablet };