@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
25 lines (24 loc) • 658 B
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
let currentLocation;
const subscribers = [];
export const setCurrentLocation = (location) => {
currentLocation = location;
subscribers.forEach((subscriber) => {
subscriber(location);
});
};
export const onLocationChange = (callback, eager = true) => {
if (eager && typeof currentLocation === 'string') {
callback(currentLocation);
}
subscribers.push(callback);
return () => {
const index = subscribers.indexOf(callback);
if (index >= 0) {
subscribers.splice(index, 1);
}
};
};
//# sourceMappingURL=ariaCurrentService.js.map