Skip to main content
Glama
test_observer.js759 B
class NotificationService { constructor() { this.subscribers = []; } subscribe(callback) { this.subscribers.push(callback); } notify(message) { // Сложность: вызов функции, которая является элементом массива this.subscribers.forEach(callback => { // Зависимость: callback ожидает строку 'message' callback(message); }); } } const service = new NotificationService(); // Подписчик 1 service.subscribe((msg) => { console.log("Log:", msg.toUpperCase()); }); // Подписчик 2 function alertUser(text) { console.log("Alert:", text.length); } service.subscribe(alertUser);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yrannkv/mcp-edit-math'

If you have feedback or need assistance with the MCP directory API, please join our Discord server