@opengeoweb/metronome 16.0.0 → 17.0.0

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.
package/index.esm.js CHANGED
@@ -53,6 +53,10 @@ function _unsupportedIterableToArray(r, a) {
53
53
  */
54
54
  var Metronome = /*#__PURE__*/function () {
55
55
  function Metronome() {
56
+ this.tickId = void 0;
57
+ this.timers = void 0;
58
+ this.interval = void 0;
59
+ this.handleTimerTicks = void 0;
56
60
  this.tickId = 0;
57
61
  this.step = this.step.bind(this);
58
62
  this.isPaused = this.isPaused.bind(this);
@@ -100,6 +104,7 @@ var Metronome = /*#__PURE__*/function () {
100
104
  (_this$handleTimerTick = this.handleTimerTicks) == null || _this$handleTimerTick.call(this, triggeredTimerIds);
101
105
  }
102
106
  }
107
+
103
108
  /**
104
109
  * Multiple timers with varying frequencies can be made at the same
105
110
  * time however each timerId must be unique. If you attempt to create
@@ -127,6 +132,7 @@ var Metronome = /*#__PURE__*/function () {
127
132
  });
128
133
  return this.timers.at(-1);
129
134
  }
135
+
130
136
  /**
131
137
  * Unregistering a timer completely removes it, if you want to pause a
132
138
  * timer, then use pauseTimer()
@@ -141,6 +147,7 @@ var Metronome = /*#__PURE__*/function () {
141
147
  this.timers.splice(indexToRemove, 1);
142
148
  }
143
149
  }
150
+
144
151
  /**
145
152
  * Checks if a timer is paused
146
153
  *
@@ -156,6 +163,7 @@ var Metronome = /*#__PURE__*/function () {
156
163
  }
157
164
  return false;
158
165
  }
166
+
159
167
  /**
160
168
  * Continues running a timer
161
169
  *
@@ -170,6 +178,7 @@ var Metronome = /*#__PURE__*/function () {
170
178
  }
171
179
  }
172
180
  }
181
+
173
182
  /**
174
183
  * Pauses a timer
175
184
  *
@@ -184,6 +193,7 @@ var Metronome = /*#__PURE__*/function () {
184
193
  }
185
194
  }
186
195
  }
196
+
187
197
  /**
188
198
  * Toggles a timer to be paused or running. Be careful when asking redux
189
199
  * to toggle a timer, it might toggle twice and therefore do nothing
@@ -199,6 +209,7 @@ var Metronome = /*#__PURE__*/function () {
199
209
  }
200
210
  }
201
211
  }
212
+
202
213
  /**
203
214
  * Sets the speed of a timer to a new frequency given in hertz
204
215
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/metronome",
3
- "version": "16.0.0",
3
+ "version": "17.0.0",
4
4
  "description": "GeoWeb metronome library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,7 +8,7 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "devDependencies": {
11
- "eslint-plugin-storybook": "9.0.17"
11
+ "eslint-plugin-storybook": "10.3.3"
12
12
  },
13
13
  "dependencies": {},
14
14
  "module": "./index.esm.js",
package/src/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { metronome } from './lib/metronome';
@@ -1,76 +0,0 @@
1
- type TimerFunction = (timerId: string, tickId: number) => void;
2
- interface Timer {
3
- timerFunc: TimerFunction | null;
4
- hertz: number;
5
- timerId: string;
6
- isPaused: boolean;
7
- }
8
- /**
9
- * This class should NEVER be initialized with new Metronome(). Use the
10
- * exported variable. To reset the metronome use unregisterAllTimers()
11
- * to remove all existing timers followed by init() to initialize the
12
- * ticks.
13
- */
14
- declare class Metronome {
15
- tickId: number;
16
- timers: Timer[];
17
- interval: NodeJS.Timeout | null;
18
- handleTimerTicks: ((timerIds: string[]) => void) | null;
19
- constructor();
20
- init(): void;
21
- unregisterAllTimers(): void;
22
- step(): void;
23
- /**
24
- * Multiple timers with varying frequencies can be made at the same
25
- * time however each timerId must be unique. If you attempt to create
26
- * two timers with the same timerId, the second will silently be ignored.
27
- *
28
- * @param timerFunc The function to be executed at the given hertz frequency
29
- * @param hertz Frequency of the timer given in hertz
30
- * @param timerId Id of the timer
31
- * @returns Timer or nothing if no timer was created
32
- */
33
- register(timerFunc: TimerFunction | null, hertz: number, timerId: string): Timer | undefined;
34
- /**
35
- * Unregistering a timer completely removes it, if you want to pause a
36
- * timer, then use pauseTimer()
37
- *
38
- * @param timerId Id of the timer
39
- */
40
- unregister(timerId: string): void;
41
- /**
42
- * Checks if a timer is paused
43
- *
44
- * @param timerId Id of the timer
45
- * @returns true if the timer is paused, false if it is running
46
- */
47
- isPaused(timerId: string): boolean;
48
- /**
49
- * Continues running a timer
50
- *
51
- * @param timerId Id of the timer
52
- */
53
- continueTimer(timerId: string): void;
54
- /**
55
- * Pauses a timer
56
- *
57
- * @param timerId Id of the timer
58
- */
59
- pauseTimer(timerId: string): void;
60
- /**
61
- * Toggles a timer to be paused or running. Be careful when asking redux
62
- * to toggle a timer, it might toggle twice and therefore do nothing
63
- *
64
- * @param timerId Id of the timer
65
- */
66
- toggleTimer(timerId: string): void;
67
- /**
68
- * Sets the speed of a timer to a new frequency given in hertz
69
- *
70
- * @param timerId Id of the timer
71
- * @param hertz Frequency of the timer given in hertz
72
- */
73
- setSpeed(timerId: string, hertz: number): void;
74
- }
75
- declare const metronome: Metronome;
76
- export { metronome };
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { metronome } from './metronome';
3
- declare const meta: Meta<typeof metronome>;
4
- export default meta;
5
- type Story = StoryObj<typeof metronome>;
6
- export declare const MetronomeCanvasPlaygroundDemo: Story;
7
- export declare const MetronomeCanvasDemo: Story;