MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / _setupRegistry

Method _setupRegistry

src/monogatari.ts:2347–2374  ·  view source on GitHub ↗

* @static _setupRegistry - Configure the Pandora Registry for centralized * component lifecycle tracking and error handling. * * This provides: * - Centralized error handling for all component lifecycle methods * - Debug logging when Monogatari debug mode is enabled * - Mount/unmou

()

Source from the content-addressed store, hash-verified

2345 * @private
2346 */
2347 static _setupRegistry () {
2348 // Enable Registry debug mode when Monogatari is in debug mode
2349 if (typeof MonogatariDebug === 'object') {
2350 Registry.debug = true;
2351 }
2352
2353 // Centralized error handling for component errors
2354 Registry.onError ((error, component, tag, lifecycle) => {
2355 FancyError.show ('engine:component:lifecycle_error', {
2356 tag: tag,
2357 lifecycle: lifecycle,
2358 errorMessage: error.message,
2359 stackTrace: error.stack
2360 });
2361 // Also log to console for debugging
2362 console.error (`[Monogatari] Component error in <${tag}> during ${lifecycle}:`, error);
2363 });
2364
2365 // Track component mounts for debugging
2366 Registry.onMount ((component, tag) => {
2367 this.trigger ('componentDidMount', { component, tag });
2368 });
2369
2370 // Track component unmounts for debugging
2371 Registry.onUnmount ((component, tag) => {
2372 this.trigger ('componentDidUnmount', { component, tag });
2373 });
2374 }
2375
2376 static async init (selector = '#monogatari') {
2377 this._selector = selector;

Callers 1

initMethod · 0.95

Calls 2

triggerMethod · 0.95
showMethod · 0.45

Tested by

no test coverage detected