| import { useRef } from 'react'; | |
| const safeDocument: Document = document; | |
| /** | |
| * Usage: | |
| * const [blockScroll, allowScroll] = useScrollBlock(); | |
| */ | |
| export const useScrollBlock = (): [() => void, () => void] => { | |
| const scrollBlocked = useRef(false); |
| // This injects a box into the page that moves with the mouse; | |
| // Useful for debugging | |
| async function installMouseHelper(page) { | |
| await page.evaluateOnNewDocument(() => { | |
| // Install mouse helper only for top-level frame. | |
| if (window !== window.parent) | |
| return; | |
| window.addEventListener('DOMContentLoaded', () => { | |
| const box = document.createElement('puppeteer-mouse-pointer'); | |
| const styleElement = document.createElement('style'); |
| import { useRef } from 'react'; | |
| const safeDocument = typeof document !== 'undefined' ? document : {}; | |
| /** | |
| * Usage: | |
| * const [blockScroll, allowScroll] = useScrollBlock(); | |
| */ | |
| export default () => { | |
| const scrollBlocked = useRef(); |
We dropped Lerna from our monorepo architecture in PouchDB 6.0.0. I got a question about this from @reconbot, so I thought I'd explain our reasoning.
First off, I don't want this post to be read as "Lerna sucks, don't use Lerna." We started out using Lerna, but eventually outgrew it because we wrote our own custom thing. Lerna is still a great idea if you're getting started with monorepos (monorepi?).
Backstory:
| var asyncParallel = function(tasks, callback) { | |
| var results = []; | |
| var count = tasks.length; | |
| tasks.forEach(function(task, index) { | |
| task(function(err, data) { | |
| results[index] = data; | |
| if (err) { | |
| callback && callback(err); | |
| callback = null; | |
| } |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft,elem.offsetTop,elem.offsetWidth,elem.offsetHeight,elem.offsetParent
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
- Ensure any install or build dependencies are removed before the end of the layer when doing a
Here's a little walkthrough of how Yannick and I are using feature branches and pull requests to develop new features and adding them to the project. Below are the steps I take when working on a new feature. Hopefully this, along with watching the process on Github, will serve as a starting point to having everyone use a similar workflow.
Questions, comments, and suggestions for improvements welcome!
When starting a new feature, I make sure to start with the latest and greatest codebase:
git checkout master