This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)
Given the code
import * as React from "react"; | |
import { useMousePosition } from "~/hooks/useMousePosition"; | |
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */ | |
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) { | |
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {}; | |
const [mouseX, mouseY] = useMousePosition(); | |
const positions = { x, y, h, w, mouseX, mouseY }; | |
return ( | |
<div |
const createLogger = (backgroundColor, color) => { | |
const logger = (message, ...args) => { | |
if (logger.enabled === false) { | |
return; | |
} | |
console.groupCollapsed( | |
`%c${message}`, | |
`background-color: ${backgroundColor}; color: ${color}; padding: 2px 4px;`, | |
...args |
Moved to https://github.com/ebidel/puppeteer-examples |
let cache = new Map(); | |
let pending = new Map(); | |
function fetchTextSync(url) { | |
if (cache.has(url)) { | |
return cache.get(url); | |
} | |
if (pending.has(url)) { | |
throw pending.get(url); | |
} |
"scripts": { | |
"start": "node node_modules/react-native/local-cli/cli.js start", | |
"rc-start": "npm start -- --reset-cache", | |
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean", | |
"clean-start": "npm run clean && npm run rc-start", | |
"fresh-install": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build/ModuleCache/* && rm -rf node_modules/ && npm cache clean && npm install", | |
"fresh-start" : "npm run fresh-install && npm run rc-start", | |
"tron": "node_modules/.bin/reactotron" | |
} |
/*! Firebase-util - v0.1.2 - 2014-01-11 | |
* https://github.com/firebase/firebase-util | |
* Copyright (c) 2014 Firebase | |
* MIT LICENSE */ | |
(function(exports) { | |
/** | |
* @var {Object} a namespace to store internal utils for use by Firebase.Util methods | |
*/ |
import { Navigator } from 'react-native'; | |
import PixelRatio from 'PixelRatio'; | |
import Dimensions from 'Dimensions'; | |
import buildStyleInterpolator from 'buildStyleInterpolator'; | |
// use FloatFromRight as starting template | |
const BaseConfig = Navigator.SceneConfigs.FloatFromRight; | |
// create custom navigator transition |
/** | |
* The examples provided by Facebook are for non-commercial testing and | |
* evaluation purposes only. | |
* | |
* Facebook reserves all rights not expressly granted. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | |
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |