@whereby.com/core 0.2.0-beta.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/README.md +15 -0
- package/dist/debounce-IlgXge5U.js +20 -0
- package/dist/index.d.ts +4252 -0
- package/dist/index.js +8507 -0
- package/dist/utils.d.ts +29 -0
- package/dist/utils.js +91 -0
- package/package.json +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# `@whereby.com/core`
|
|
2
|
+
|
|
3
|
+
`@whereby.com/core` is an internal package containing business logic (API calls and state management etc.) to power the browser SDK, React Native and other forms of Whereby meetings. It also contains utils which may be useful in custom experiences.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm install @whereby.com/browser-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
or
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
yarn add @whereby.com/browser-core
|
|
15
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function debounce(fn, { delay = 500, edges } = {}) {
|
|
2
|
+
let timeout;
|
|
3
|
+
let nCalls = 0;
|
|
4
|
+
return (...args) => {
|
|
5
|
+
nCalls += 1;
|
|
6
|
+
if (edges && nCalls === 1) {
|
|
7
|
+
fn(...args);
|
|
8
|
+
}
|
|
9
|
+
clearTimeout(timeout);
|
|
10
|
+
timeout = setTimeout(() => {
|
|
11
|
+
if (!edges || nCalls > 1) {
|
|
12
|
+
fn(...args);
|
|
13
|
+
}
|
|
14
|
+
timeout = undefined;
|
|
15
|
+
nCalls = 0;
|
|
16
|
+
}, delay);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { debounce as d };
|