/**
* part of Hachette
* Facilitate listening to events
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
*/
function make()
{
return new Set();
}
function subscribe(observable, cb)
{
observable.add(cb);
}
function unsubscribe(observable, cb)
{
observable.delete(cb);
}
function broadcast(observable, event)
{
for (const callback of observable)
callback(event);
}
const observables = {make, subscribe, unsubscribe, broadcast};
/*
* EXPORTS_START
* EXPORT observables
* EXPORTS_END
*/
form'>
Wojtek's customized Guix | |