wu-framework 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/wu-registry.js +25 -12
- package/src/index.js +5 -6
package/package.json
CHANGED
package/src/core/wu-registry.js
CHANGED
|
@@ -34,21 +34,34 @@ export class WuRegistry {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
// API para que apps notifiquen que están listas (se agrega a window.wu cuando exista)
|
|
38
|
+
// No crear window.wu aquí - eso lo hace index.js con la instancia completa
|
|
39
|
+
this._setupNotifyReady();
|
|
40
|
+
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
/**
|
|
43
|
+
* 🔔 Setup notifyReady API cuando window.wu esté disponible
|
|
44
|
+
*/
|
|
45
|
+
_setupNotifyReady() {
|
|
46
|
+
const setupFn = () => {
|
|
47
|
+
if (window.wu && !window.wu.notifyReady) {
|
|
48
|
+
window.wu.notifyReady = (appName) => {
|
|
49
|
+
console.log(`[WuRegistry] 📢 App ${appName} called notifyReady()`);
|
|
50
|
+
const event = new CustomEvent('wu:app:ready', {
|
|
51
|
+
detail: { appName, timestamp: Date.now() }
|
|
52
|
+
});
|
|
53
|
+
window.dispatchEvent(event);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
45
57
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
58
|
+
// Intentar setup inmediato
|
|
59
|
+
setupFn();
|
|
49
60
|
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
// Si window.wu no existe aún, esperar un tick
|
|
62
|
+
if (!window.wu) {
|
|
63
|
+
queueMicrotask(setupFn);
|
|
64
|
+
}
|
|
52
65
|
}
|
|
53
66
|
|
|
54
67
|
/**
|
package/src/index.js
CHANGED
|
@@ -98,14 +98,13 @@ if (typeof window !== 'undefined' && window.wu && window.wu._isWuFramework) {
|
|
|
98
98
|
|
|
99
99
|
// Hacer wu disponible globalmente
|
|
100
100
|
if (typeof window !== 'undefined') {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
console.log('🚀 Wu Framework loaded - Universal Microfrontends ready');
|
|
104
|
-
}
|
|
101
|
+
// SIEMPRE configurar window.wu con la instancia real (puede haber un objeto vacío)
|
|
102
|
+
window.wu = wu;
|
|
105
103
|
|
|
106
|
-
//
|
|
104
|
+
// Configurar propiedades si no existen
|
|
107
105
|
if (!wu.version) {
|
|
108
|
-
wu.version = '1.0.
|
|
106
|
+
wu.version = '1.0.3';
|
|
107
|
+
console.log('🚀 Wu Framework loaded - Universal Microfrontends ready');
|
|
109
108
|
wu.info = {
|
|
110
109
|
name: 'Wu Framework',
|
|
111
110
|
description: 'Universal Microfrontends',
|