Skip to content

Commit

Permalink
chore: update dependencies & tweak event bus
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnixon committed Jan 2, 2023
1 parent e8914b8 commit 1657d64
Show file tree
Hide file tree
Showing 23 changed files with 285 additions and 5 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
"@carbon/layout": "^10.37.1",
"@carbon/themes": "^10.55.1",
"@carbon/type": "^10.45.1",
"@storybook/addon-storysource": "^6.5.15",
"@vueuse/core": "^4.11.2",
"carbon-components": "^10.58.5",
"debug": "^4.3.4",
"remove": "^0.1.5",
"stylelint-config-property-sort-order-smacss": "^9.0.0",
"stylelint-config-sass-guidelines": "^9.0.1",
Expand Down
11 changes: 7 additions & 4 deletions src/global/component-utils/event-bus.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import { EventEmitter } from 'events';
import { unref } from 'vue';

class EventBus extends EventEmitter {}

const busses = {};
/**
* Get an event bus
* @param {string} id unique id
* @param {string} busId unique id
* @returns {EventBus}
*/
export function getBus(id) {
export function getBus(busId) {
const id = unref(busId);
if (!(id in busses)) busses[id] = new EventBus();
return busses[id];
}
/**
* Remove a previously created event bus
* @param {string} id unique id
* @param {string} busId unique id
* @returns {EventBus}
*/
export function removeBus(id) {
export function removeBus(busId) {
const id = unref(busId);
delete busses[id];
}
Loading

0 comments on commit 1657d64

Please sign in to comment.