Skip to content

Instantly share code, notes, and snippets.

View aidenybai's full-sized avatar

Aiden Bai aidenybai

View GitHub Profile
@aidenybai
aidenybai / fps-block.js
Created December 11, 2024 12:27
"fun" way to annoy your coworkers AND get them to care about performance (block all user interaction if FPS < 50)
(() => {
const fpsDiv = document.createElement('div');
fpsDiv.style.position = 'fixed';
fpsDiv.style.bottom = '0px';
fpsDiv.style.right = '0px';
fpsDiv.style.fontSize = '12px';
fpsDiv.style.backgroundColor = 'lightgreen';
fpsDiv.style.padding = '5px';
fpsDiv.style.zIndex = '9999';
fpsDiv.style.width = '50px';
import { detectReactBuildType, getRDTHook, type ReactRenderer } from "bippy";
const devRenderers: ReactRenderer[] = [];
const originalScheduleRefreshFns: ReactRenderer["scheduleRefresh"][] = [];
const originalScheduleUpdateFns: ReactRenderer["scheduleUpdate"][] = [];
const originalScheduleRootFns: ReactRenderer["scheduleRoot"][] = [];
let isHMRDisabled = false;
interface QueuedUpdate {
args: any[];