Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

262 B
Raw Blame
"""A tiny event bus."""

_handlers = {}


def subscribe(name, handler):
    _handlers.setdefault(name, []).append(handler)


def publish(name, payload):
    for handler in _handlers.get(name, []):
        handler(payload)
    return len(_handlers.get(name, []))