next-mdx-remote-client
Version:
A wrapper of the `@mdx-js/mdx` for the `nextjs` applications in order to load MDX content. It is a fork of `next-mdx-remote`.
25 lines (22 loc) • 579 B
JavaScript
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*
* reference to https://github.com/hashicorp/next-mdx-remote/blob/main/src/idle-callback-polyfill.js
*/
if (typeof window !== "undefined") {
window.requestIdleCallback ||= function (cb) {
var start = Date.now();
return setTimeout(function () {
cb({
didTimeout: false,
timeRemaining: function () {
return Math.max(0, 50 - (Date.now() - start));
},
});
}, 1);
};
window.cancelIdleCallback ||= function (id) {
clearTimeout(id);
};
}