@opengeoweb/metronome 9.28.1 → 9.29.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 +58 -58
- package/package.json +1 -1
- package/src/index.d.ts +1 -1
- package/src/lib/metronome.d.ts +77 -77
- package/src/lib/metronome.spec.d.ts +1 -1
- package/src/lib/metronome.stories.d.ts +7 -7
package/index.esm.js
CHANGED
|
@@ -1729,28 +1729,28 @@ for (var COLLECTION_NAME in DOMIterables) {
|
|
|
1729
1729
|
|
|
1730
1730
|
handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
|
|
1731
1731
|
|
|
1732
|
-
/* *
|
|
1733
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1734
|
-
* you may not use this file except in compliance with the License.
|
|
1735
|
-
* You may obtain a copy of the License at
|
|
1736
|
-
*
|
|
1737
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1738
|
-
*
|
|
1739
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1740
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1741
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1742
|
-
* See the License for the specific language governing permissions and
|
|
1743
|
-
* limitations under the License.
|
|
1744
|
-
*
|
|
1745
|
-
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1746
|
-
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
1747
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1732
|
+
/* *
|
|
1733
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1734
|
+
* you may not use this file except in compliance with the License.
|
|
1735
|
+
* You may obtain a copy of the License at
|
|
1736
|
+
*
|
|
1737
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1738
|
+
*
|
|
1739
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1740
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1741
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1742
|
+
* See the License for the specific language governing permissions and
|
|
1743
|
+
* limitations under the License.
|
|
1744
|
+
*
|
|
1745
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1746
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
1747
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1748
1748
|
* */
|
|
1749
|
-
/**
|
|
1750
|
-
* This class should NEVER be initialized with new Metronome(). Use the
|
|
1751
|
-
* exported variable. To reset the metronome use unregisterAllTimers()
|
|
1752
|
-
* to remove all existing timers followed by init() to initialize the
|
|
1753
|
-
* ticks.
|
|
1749
|
+
/**
|
|
1750
|
+
* This class should NEVER be initialized with new Metronome(). Use the
|
|
1751
|
+
* exported variable. To reset the metronome use unregisterAllTimers()
|
|
1752
|
+
* to remove all existing timers followed by init() to initialize the
|
|
1753
|
+
* ticks.
|
|
1754
1754
|
*/
|
|
1755
1755
|
class Metronome {
|
|
1756
1756
|
constructor() {
|
|
@@ -1798,15 +1798,15 @@ class Metronome {
|
|
|
1798
1798
|
this.handleTimerTicks && this.handleTimerTicks(triggeredTimerIds);
|
|
1799
1799
|
}
|
|
1800
1800
|
}
|
|
1801
|
-
/**
|
|
1802
|
-
* Multiple timers with varying frequencies can be made at the same
|
|
1803
|
-
* time however each timerId must be unique. If you attempt to create
|
|
1804
|
-
* two timers with the same timerId, the second will silently be ignored.
|
|
1805
|
-
*
|
|
1806
|
-
* @param timerFunc The function to be executed at the given hertz frequency
|
|
1807
|
-
* @param hertz Frequency of the timer given in hertz
|
|
1808
|
-
* @param timerId Id of the timer
|
|
1809
|
-
* @returns Timer or nothing if no timer was created
|
|
1801
|
+
/**
|
|
1802
|
+
* Multiple timers with varying frequencies can be made at the same
|
|
1803
|
+
* time however each timerId must be unique. If you attempt to create
|
|
1804
|
+
* two timers with the same timerId, the second will silently be ignored.
|
|
1805
|
+
*
|
|
1806
|
+
* @param timerFunc The function to be executed at the given hertz frequency
|
|
1807
|
+
* @param hertz Frequency of the timer given in hertz
|
|
1808
|
+
* @param timerId Id of the timer
|
|
1809
|
+
* @returns Timer or nothing if no timer was created
|
|
1810
1810
|
*/
|
|
1811
1811
|
register(timerFunc, hertz, timerId) {
|
|
1812
1812
|
const existingTimer = this.timers.find(timer => timer.timerId === timerId);
|
|
@@ -1823,11 +1823,11 @@ class Metronome {
|
|
|
1823
1823
|
});
|
|
1824
1824
|
return this.timers.at(-1);
|
|
1825
1825
|
}
|
|
1826
|
-
/**
|
|
1827
|
-
* Unregistering a timer completely removes it, if you want to pause a
|
|
1828
|
-
* timer, then use pauseTimer()
|
|
1829
|
-
*
|
|
1830
|
-
* @param timerId Id of the timer
|
|
1826
|
+
/**
|
|
1827
|
+
* Unregistering a timer completely removes it, if you want to pause a
|
|
1828
|
+
* timer, then use pauseTimer()
|
|
1829
|
+
*
|
|
1830
|
+
* @param timerId Id of the timer
|
|
1831
1831
|
*/
|
|
1832
1832
|
unregister(timerId) {
|
|
1833
1833
|
const indexToRemove = this.timers.findIndex(timer => timer.timerId === timerId);
|
|
@@ -1835,11 +1835,11 @@ class Metronome {
|
|
|
1835
1835
|
this.timers.splice(indexToRemove, 1);
|
|
1836
1836
|
}
|
|
1837
1837
|
}
|
|
1838
|
-
/**
|
|
1839
|
-
* Checks if a timer is paused
|
|
1840
|
-
*
|
|
1841
|
-
* @param timerId Id of the timer
|
|
1842
|
-
* @returns true if the timer is paused, false if it is running
|
|
1838
|
+
/**
|
|
1839
|
+
* Checks if a timer is paused
|
|
1840
|
+
*
|
|
1841
|
+
* @param timerId Id of the timer
|
|
1842
|
+
* @returns true if the timer is paused, false if it is running
|
|
1843
1843
|
*/
|
|
1844
1844
|
isPaused(timerId) {
|
|
1845
1845
|
for (const timer of this.timers) {
|
|
@@ -1849,10 +1849,10 @@ class Metronome {
|
|
|
1849
1849
|
}
|
|
1850
1850
|
return false;
|
|
1851
1851
|
}
|
|
1852
|
-
/**
|
|
1853
|
-
* Continues running a timer
|
|
1854
|
-
*
|
|
1855
|
-
* @param timerId Id of the timer
|
|
1852
|
+
/**
|
|
1853
|
+
* Continues running a timer
|
|
1854
|
+
*
|
|
1855
|
+
* @param timerId Id of the timer
|
|
1856
1856
|
*/
|
|
1857
1857
|
continueTimer(timerId) {
|
|
1858
1858
|
for (const timer of this.timers) {
|
|
@@ -1862,10 +1862,10 @@ class Metronome {
|
|
|
1862
1862
|
}
|
|
1863
1863
|
}
|
|
1864
1864
|
}
|
|
1865
|
-
/**
|
|
1866
|
-
* Pauses a timer
|
|
1867
|
-
*
|
|
1868
|
-
* @param timerId Id of the timer
|
|
1865
|
+
/**
|
|
1866
|
+
* Pauses a timer
|
|
1867
|
+
*
|
|
1868
|
+
* @param timerId Id of the timer
|
|
1869
1869
|
*/
|
|
1870
1870
|
pauseTimer(timerId) {
|
|
1871
1871
|
for (const timer of this.timers) {
|
|
@@ -1875,11 +1875,11 @@ class Metronome {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
1877
|
}
|
|
1878
|
-
/**
|
|
1879
|
-
* Toggles a timer to be paused or running. Be careful when asking redux
|
|
1880
|
-
* to toggle a timer, it might toggle twice and therefore do nothing
|
|
1881
|
-
*
|
|
1882
|
-
* @param timerId Id of the timer
|
|
1878
|
+
/**
|
|
1879
|
+
* Toggles a timer to be paused or running. Be careful when asking redux
|
|
1880
|
+
* to toggle a timer, it might toggle twice and therefore do nothing
|
|
1881
|
+
*
|
|
1882
|
+
* @param timerId Id of the timer
|
|
1883
1883
|
*/
|
|
1884
1884
|
toggleTimer(timerId) {
|
|
1885
1885
|
for (const timer of this.timers) {
|
|
@@ -1889,11 +1889,11 @@ class Metronome {
|
|
|
1889
1889
|
}
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
|
-
/**
|
|
1893
|
-
* Sets the speed of a timer to a new frequency given in hertz
|
|
1894
|
-
*
|
|
1895
|
-
* @param timerId Id of the timer
|
|
1896
|
-
* @param hertz Frequency of the timer given in hertz
|
|
1892
|
+
/**
|
|
1893
|
+
* Sets the speed of a timer to a new frequency given in hertz
|
|
1894
|
+
*
|
|
1895
|
+
* @param timerId Id of the timer
|
|
1896
|
+
* @param hertz Frequency of the timer given in hertz
|
|
1897
1897
|
*/
|
|
1898
1898
|
setSpeed(timerId, hertz) {
|
|
1899
1899
|
for (const timer of this.timers) {
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { metronome } from './lib/metronome';
|
|
1
|
+
export { metronome } from './lib/metronome';
|
package/src/lib/metronome.d.ts
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
type TimerFunction = (timerId: string, tickId: number) => void;
|
|
3
|
-
interface Timer {
|
|
4
|
-
timerFunc: TimerFunction | null;
|
|
5
|
-
hertz: number;
|
|
6
|
-
timerId: string;
|
|
7
|
-
isPaused: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* This class should NEVER be initialized with new Metronome(). Use the
|
|
11
|
-
* exported variable. To reset the metronome use unregisterAllTimers()
|
|
12
|
-
* to remove all existing timers followed by init() to initialize the
|
|
13
|
-
* ticks.
|
|
14
|
-
*/
|
|
15
|
-
declare class Metronome {
|
|
16
|
-
tickId: number;
|
|
17
|
-
timers: Timer[];
|
|
18
|
-
interval: NodeJS.Timeout | null;
|
|
19
|
-
handleTimerTicks: ((timerIds: string[]) => void) | null;
|
|
20
|
-
constructor();
|
|
21
|
-
init(): void;
|
|
22
|
-
unregisterAllTimers(): void;
|
|
23
|
-
step(): void;
|
|
24
|
-
/**
|
|
25
|
-
* Multiple timers with varying frequencies can be made at the same
|
|
26
|
-
* time however each timerId must be unique. If you attempt to create
|
|
27
|
-
* two timers with the same timerId, the second will silently be ignored.
|
|
28
|
-
*
|
|
29
|
-
* @param timerFunc The function to be executed at the given hertz frequency
|
|
30
|
-
* @param hertz Frequency of the timer given in hertz
|
|
31
|
-
* @param timerId Id of the timer
|
|
32
|
-
* @returns Timer or nothing if no timer was created
|
|
33
|
-
*/
|
|
34
|
-
register(timerFunc: TimerFunction | null, hertz: number, timerId: string): Timer | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Unregistering a timer completely removes it, if you want to pause a
|
|
37
|
-
* timer, then use pauseTimer()
|
|
38
|
-
*
|
|
39
|
-
* @param timerId Id of the timer
|
|
40
|
-
*/
|
|
41
|
-
unregister(timerId: string): void;
|
|
42
|
-
/**
|
|
43
|
-
* Checks if a timer is paused
|
|
44
|
-
*
|
|
45
|
-
* @param timerId Id of the timer
|
|
46
|
-
* @returns true if the timer is paused, false if it is running
|
|
47
|
-
*/
|
|
48
|
-
isPaused(timerId: string): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Continues running a timer
|
|
51
|
-
*
|
|
52
|
-
* @param timerId Id of the timer
|
|
53
|
-
*/
|
|
54
|
-
continueTimer(timerId: string): void;
|
|
55
|
-
/**
|
|
56
|
-
* Pauses a timer
|
|
57
|
-
*
|
|
58
|
-
* @param timerId Id of the timer
|
|
59
|
-
*/
|
|
60
|
-
pauseTimer(timerId: string): void;
|
|
61
|
-
/**
|
|
62
|
-
* Toggles a timer to be paused or running. Be careful when asking redux
|
|
63
|
-
* to toggle a timer, it might toggle twice and therefore do nothing
|
|
64
|
-
*
|
|
65
|
-
* @param timerId Id of the timer
|
|
66
|
-
*/
|
|
67
|
-
toggleTimer(timerId: string): void;
|
|
68
|
-
/**
|
|
69
|
-
* Sets the speed of a timer to a new frequency given in hertz
|
|
70
|
-
*
|
|
71
|
-
* @param timerId Id of the timer
|
|
72
|
-
* @param hertz Frequency of the timer given in hertz
|
|
73
|
-
*/
|
|
74
|
-
setSpeed(timerId: string, hertz: number): void;
|
|
75
|
-
}
|
|
76
|
-
declare const metronome: Metronome;
|
|
77
|
-
export { metronome };
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
type TimerFunction = (timerId: string, tickId: number) => void;
|
|
3
|
+
interface Timer {
|
|
4
|
+
timerFunc: TimerFunction | null;
|
|
5
|
+
hertz: number;
|
|
6
|
+
timerId: string;
|
|
7
|
+
isPaused: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* This class should NEVER be initialized with new Metronome(). Use the
|
|
11
|
+
* exported variable. To reset the metronome use unregisterAllTimers()
|
|
12
|
+
* to remove all existing timers followed by init() to initialize the
|
|
13
|
+
* ticks.
|
|
14
|
+
*/
|
|
15
|
+
declare class Metronome {
|
|
16
|
+
tickId: number;
|
|
17
|
+
timers: Timer[];
|
|
18
|
+
interval: NodeJS.Timeout | null;
|
|
19
|
+
handleTimerTicks: ((timerIds: string[]) => void) | null;
|
|
20
|
+
constructor();
|
|
21
|
+
init(): void;
|
|
22
|
+
unregisterAllTimers(): void;
|
|
23
|
+
step(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Multiple timers with varying frequencies can be made at the same
|
|
26
|
+
* time however each timerId must be unique. If you attempt to create
|
|
27
|
+
* two timers with the same timerId, the second will silently be ignored.
|
|
28
|
+
*
|
|
29
|
+
* @param timerFunc The function to be executed at the given hertz frequency
|
|
30
|
+
* @param hertz Frequency of the timer given in hertz
|
|
31
|
+
* @param timerId Id of the timer
|
|
32
|
+
* @returns Timer or nothing if no timer was created
|
|
33
|
+
*/
|
|
34
|
+
register(timerFunc: TimerFunction | null, hertz: number, timerId: string): Timer | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Unregistering a timer completely removes it, if you want to pause a
|
|
37
|
+
* timer, then use pauseTimer()
|
|
38
|
+
*
|
|
39
|
+
* @param timerId Id of the timer
|
|
40
|
+
*/
|
|
41
|
+
unregister(timerId: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if a timer is paused
|
|
44
|
+
*
|
|
45
|
+
* @param timerId Id of the timer
|
|
46
|
+
* @returns true if the timer is paused, false if it is running
|
|
47
|
+
*/
|
|
48
|
+
isPaused(timerId: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Continues running a timer
|
|
51
|
+
*
|
|
52
|
+
* @param timerId Id of the timer
|
|
53
|
+
*/
|
|
54
|
+
continueTimer(timerId: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Pauses a timer
|
|
57
|
+
*
|
|
58
|
+
* @param timerId Id of the timer
|
|
59
|
+
*/
|
|
60
|
+
pauseTimer(timerId: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Toggles a timer to be paused or running. Be careful when asking redux
|
|
63
|
+
* to toggle a timer, it might toggle twice and therefore do nothing
|
|
64
|
+
*
|
|
65
|
+
* @param timerId Id of the timer
|
|
66
|
+
*/
|
|
67
|
+
toggleTimer(timerId: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Sets the speed of a timer to a new frequency given in hertz
|
|
70
|
+
*
|
|
71
|
+
* @param timerId Id of the timer
|
|
72
|
+
* @param hertz Frequency of the timer given in hertz
|
|
73
|
+
*/
|
|
74
|
+
setSpeed(timerId: string, hertz: number): void;
|
|
75
|
+
}
|
|
76
|
+
declare const metronome: Metronome;
|
|
77
|
+
export { metronome };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare const _default: {
|
|
3
|
-
title: string;
|
|
4
|
-
};
|
|
5
|
-
export default _default;
|
|
6
|
-
export declare const MetronomeCanvasPlaygroundDemo: React.FC;
|
|
7
|
-
export declare const MetronomeCanvasDemo: React.FC;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const MetronomeCanvasPlaygroundDemo: React.FC;
|
|
7
|
+
export declare const MetronomeCanvasDemo: React.FC;
|