UNPKG

xypriss-security

Version:

XyPriss Security is an advanced JavaScript security library designed for enterprise applications. It provides military-grade encryption, secure data structures, quantum-resistant cryptography, and comprehensive security utilities for modern web applicatio

52 lines (49 loc) 1.77 kB
'use strict'; /** * Global type definitions for XyPrissSecurity * * This file contains polyfills and type definitions for modern JavaScript features * that may not be available in all environments. */ /** * Runtime polyfills for WeakRef and FinalizationRegistry */ function initializePolyfills() { // Check if WeakRef is available if (typeof globalThis.WeakRef === "undefined") { // Simple polyfill for WeakRef globalThis.WeakRef = class WeakRef { constructor(target) { this.target = target; } deref() { return this.target; } }; } // Check if FinalizationRegistry is available if (typeof globalThis.FinalizationRegistry === "undefined") { // Simple polyfill for FinalizationRegistry globalThis.FinalizationRegistry = class FinalizationRegistry { constructor(cleanupCallback) { this.registrations = new Map(); this.cleanupCallback = cleanupCallback; } register(target, heldValue, unregisterToken) { this.registrations.set(target, heldValue); // Simple timeout-based cleanup (not perfect but better than nothing) setTimeout(() => { if (this.registrations.has(target)) { this.cleanupCallback(heldValue); this.registrations.delete(target); } }, 30000); // 30 seconds } unregister(unregisterToken) { return this.registrations.delete(unregisterToken); } }; } } exports.initializePolyfills = initializePolyfills; //# sourceMappingURL=global.js.map