This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useLayoutEffect, useState } from 'react'; | |
import debounce from 'lodash/debounce'; | |
const useIsMobile = (): boolean => { | |
const [isMobile, setIsMobile] = useState(false); | |
useLayoutEffect(() => { | |
const updateSize = (): void => { | |
setIsMobile(window.innerWidth < 768); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface ICountryStates { | |
name: string; | |
state_code: string; | |
} | |
export interface ICountrySchema { | |
name: string; | |
country_code: string; | |
iso3: string; | |
phone_code: string; | |
flag_emoji: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getElementByXpath(path) { | |
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
} | |
// *** use *** | |
// getElementByXpath(XpathTargetingDOMNode) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function listAllEventListeners() { | |
const allElements = Array.prototype.slice.call(document.querySelectorAll('*')); | |
allElements.push(document); | |
allElements.push(window); | |
const types = []; | |
for (let ev in window) { | |
if (/^on/.test(ev)) types[types.length] = ev; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2021-11-12T11:55:51.809Z","extensionVersion":"v3.4.3"} |