PronounsPage/plugins/polyfill.client.ts
2025-01-16 22:24:08 +00:00

21 lines
618 B
TypeScript

import { defineNuxtPlugin } from 'nuxt/app';
export default defineNuxtPlugin(() => {
if (!Object.prototype.hasOwnProperty.call(Object, 'hasOwn')) {
Object.defineProperty(Object, 'hasOwn', {
value: (object: object, property: PropertyKey) => {
return Object.prototype.hasOwnProperty.call(object, property);
},
});
}
if (!Object.hasOwn(window, 'BroadcastChannel')) {
Object.defineProperty(window, 'BroadcastChannel', {
value: class {
postMessage() {}
close() {}
},
});
}
});