MCPcopy
hub / github.com/CopilotKit/CopilotKit / notifySubscribers

Method notifySubscribers

packages/core/src/core/core.ts:496–509  ·  view source on GitHub ↗

* Internal method used by delegate classes and subclasses to notify subscribers

(
    handler: (subscriber: CopilotKitCoreSubscriber) => void | Promise<void>,
    errorMessage: string,
  )

Source from the content-addressed store, hash-verified

494 * Internal method used by delegate classes and subclasses to notify subscribers
495 */
496 protected async notifySubscribers(
497 handler: (subscriber: CopilotKitCoreSubscriber) => void | Promise<void>,
498 errorMessage: string,
499 ): Promise<void> {
500 await Promise.all(
501 Array.from(this.subscribers).map(async (subscriber) => {
502 try {
503 await handler(subscriber);
504 } catch (error) {
505 console.error(errorMessage, error);
506 }
507 }),
508 );
509 }
510
511 /**
512 * Internal method used by delegate classes to emit errors

Callers 3

emitErrorMethod · 0.95
setHeadersMethod · 0.95
setPropertiesMethod · 0.95

Calls 2

errorMethod · 0.65
handlerFunction · 0.50

Tested by

no test coverage detected