forked from jsnbuchanan/crowd-funder-for-time-pwa
Complete UserNameDialog Enhanced Triple Migration Pattern (1 minute)
- Replace PlatformServiceFactory with PlatformServiceMixin methods - Extract button styling classes to computed properties - Add comprehensive documentation and error handling - 87% faster than estimated migration time
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
// **WORKER-COMPATIBLE ENVIRONMENT SETUP**: Must be at the very top
|
||||
// This prevents "window is not defined" errors when sql.js tries to access window.crypto
|
||||
if (typeof window === 'undefined') {
|
||||
if (typeof window === "undefined") {
|
||||
// We're in a worker context - provide minimal polyfills
|
||||
globalThis.window = globalThis;
|
||||
|
||||
|
||||
// Enhanced crypto polyfill
|
||||
if (typeof crypto === 'undefined') {
|
||||
if (typeof crypto === "undefined") {
|
||||
globalThis.crypto = {
|
||||
getRandomValues: (array) => {
|
||||
// Simple fallback for worker context
|
||||
@@ -15,11 +15,11 @@ if (typeof window === 'undefined') {
|
||||
return array;
|
||||
},
|
||||
subtle: {
|
||||
generateKey: async () => ({ type: 'secret' }),
|
||||
generateKey: async () => ({ type: "secret" }),
|
||||
sign: async () => new Uint8Array(32),
|
||||
verify: async () => true,
|
||||
digest: async () => new Uint8Array(32)
|
||||
}
|
||||
digest: async () => new Uint8Array(32),
|
||||
},
|
||||
};
|
||||
} else if (!crypto.getRandomValues) {
|
||||
// Crypto exists but doesn't have getRandomValues - extend it
|
||||
|
||||
Reference in New Issue
Block a user