@renderlesskit/react
Version:
Collection of headless components/hooks that are accessible, composable, customizable from low level to build your own UI & Design System powered by Reakit
35 lines (33 loc) • 797 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var state = {
currentTooltipId: null,
listeners: new Set(),
subscribe: function subscribe(listener) {
var _this = this;
this.listeners.add(listener);
return function () {
_this.listeners.delete(listener);
};
},
show: function show(id) {
this.currentTooltipId = id;
this.listeners.forEach(function (listener) {
return listener(id);
});
},
hide: function hide(id) {
if (this.currentTooltipId === id) {
this.currentTooltipId = null;
this.listeners.forEach(function (listener) {
return listener(null);
});
}
}
};
var _default = state;
exports.default = _default;
//# sourceMappingURL=__globalState.js.map