mirror of
https://github.com/discourse/discourse.git
synced 2025-06-15 07:34:53 +08:00
This reverts commit 63b7b598cb9cd93e90e447fea24f2f517c2592c5. Causing issues in production builds
This commit is contained in:
@ -1,13 +1,8 @@
|
|||||||
import { registerWaiter } from "@ember/test";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs `callback` shortly after the next browser Frame is produced.
|
* Runs `callback` shortly after the next browser Frame is produced.
|
||||||
* ref: https://webperf.tips/tip/measuring-paint-time
|
* ref: https://webperf.tips/tip/measuring-paint-time
|
||||||
*/
|
*/
|
||||||
export default function runAfterFramePaint(callback) {
|
export default function runAfterFramePaint(callback) {
|
||||||
let done = false;
|
|
||||||
registerWaiter(() => done);
|
|
||||||
|
|
||||||
// Queue a "before Render Steps" callback via requestAnimationFrame.
|
// Queue a "before Render Steps" callback via requestAnimationFrame.
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
// MessageChannel is one of the highest priority task queues
|
// MessageChannel is one of the highest priority task queues
|
||||||
@ -15,10 +10,7 @@ export default function runAfterFramePaint(callback) {
|
|||||||
const messageChannel = new MessageChannel();
|
const messageChannel = new MessageChannel();
|
||||||
|
|
||||||
// Setup the callback to run in a Task
|
// Setup the callback to run in a Task
|
||||||
messageChannel.port1.onmessage = () => {
|
messageChannel.port1.onmessage = callback;
|
||||||
done = true;
|
|
||||||
callback();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Queue the Task on the Task Queue
|
// Queue the Task on the Task Queue
|
||||||
messageChannel.port2.postMessage(undefined);
|
messageChannel.port2.postMessage(undefined);
|
||||||
|
Reference in New Issue
Block a user