fuma 0.3.39 → 0.3.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,7 +80,7 @@ onMount(() => {
80
80
  >
81
81
  <h2 class="title min-w-0 overflow-hidden">{title}</h2>
82
82
  <button on:click={() => close()} class="btn btn-square btn-sm">
83
- <Icon path={mdiClose} title="annuler" />
83
+ <Icon path={mdiClose} title="Fermer" />
84
84
  </button>
85
85
  </div>
86
86
 
@@ -1,7 +1,8 @@
1
1
  export declare function createEventEmitter<EventMap extends Record<string, any>>(): {
2
2
  on<K extends keyof EventMap>(eventKey: K, callback: Callback<EventMap[K]>): () => void;
3
- off<K_1 extends keyof EventMap>(eventKey: K_1, callback: Callback<EventMap[K_1]>): void;
4
- emit<K_2 extends keyof EventMap>(...args: EventEmitterArgs<EventMap, K_2>): void;
3
+ once<K_1 extends keyof EventMap>(eventKey: K_1, callback: Callback<EventMap[K_1]>): () => void;
4
+ off<K_2 extends keyof EventMap>(eventKey: K_2, callback: Callback<EventMap[K_2]>): void;
5
+ emit<K_3 extends keyof EventMap>(...args: EventEmitterArgs<EventMap, K_3>): void;
5
6
  };
6
7
  type Callback<Arg> = (arg: Arg) => unknown;
7
8
  type EventEmitterArgs<EventMap extends Record<string, any>, K extends keyof EventMap> = undefined extends EventMap[K] ? [type: K, parameter?: EventMap[K]] : [type: K, parameter: EventMap[K]];
@@ -12,6 +12,22 @@ export function createEventEmitter() {
12
12
  events[eventKey].splice(index, 1);
13
13
  };
14
14
  },
15
+ once(eventKey, callback) {
16
+ if (!events[eventKey])
17
+ events[eventKey] = [];
18
+ const _callback = (arg) => {
19
+ callback(arg);
20
+ const index = events[eventKey].indexOf(callback);
21
+ events[eventKey].splice(index, 1);
22
+ };
23
+ events[eventKey].push(_callback);
24
+ return function unsubscribe() {
25
+ if (!events[eventKey])
26
+ events[eventKey] = [];
27
+ const index = events[eventKey].indexOf(callback);
28
+ events[eventKey].splice(index, 1);
29
+ };
30
+ },
15
31
  off(eventKey, callback) {
16
32
  if (!events[eventKey])
17
33
  events[eventKey] = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "0.3.39",
3
+ "version": "0.3.40",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",