A platform for community discussion. Free, open, simple.
Revert "DEV: Allow afterFramePaint to be used in tests (#27226)" (#27228)
David Taylor531fc1d754df
diff --git a/app/assets/javascripts/discourse/app/lib/after-frame-paint.js b/app/assets/javascripts/discourse/app/lib/after-frame-paint.jsindex 0e7a0f77d97..9105167eaad 100644--- a/app/assets/javascripts/discourse/app/lib/after-frame-paint.js+++ b/app/assets/javascripts/discourse/app/lib/after-frame-paint.js@@ -1,13 +1,8 @@-import { registerWaiter } from "@ember/test";-/*** Runs `callback` shortly after the next browser Frame is produced.* ref: https://webperf.tips/tip/measuring-paint-time*/export default function runAfterFramePaint(callback) {- let done = false;- registerWaiter(() => done);-// Queue a "before Render Steps" callback via requestAnimationFrame.requestAnimationFrame(() => {// MessageChannel is one of the highest priority task queues@@ -15,10 +10,7 @@ export default function runAfterFramePaint(callback) {const messageChannel = new MessageChannel();// Setup the callback to run in a Task- messageChannel.port1.onmessage = () => {- done = true;- callback();- };+ messageChannel.port1.onmessage = callback;// Queue the Task on the Task QueuemessageChannel.port2.postMessage(undefined);