@log-drop/web 1.0.0-alpha1
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 +47 -0
- package/dist/index.cjs +5927 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.js +5907 -0
- package/dist/index.js.map +7 -0
- package/dist/logdrop-sw.js +372 -0
- package/dist/logdrop.min.js +4 -0
- package/dist/logdrop.min.js.map +7 -0
- package/dist/package.json +3 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# LogDrop Web SDK
|
|
2
|
+
|
|
3
|
+
LogDrop's vanilla JavaScript browser SDK. It works with plain HTML and frontend frameworks such as React, Vue, Angular, Svelte, and Next.js client components.
|
|
4
|
+
|
|
5
|
+
## npm
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @log-drop/web
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { LogDrop } from "@log-drop/web";
|
|
13
|
+
|
|
14
|
+
LogDrop.init({
|
|
15
|
+
appId: "your-app-id",
|
|
16
|
+
apiKey: "your-api-key",
|
|
17
|
+
release: "1.0.0",
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Browser script
|
|
22
|
+
|
|
23
|
+
Load a pinned stable SDK version from the LogDrop CDN:
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<script src="https://cdn.logdrop.io/PUBLIC_FILES/logdrop-web-sdk/release/1.0.0/logdrop.min.js"></script>
|
|
27
|
+
<script>
|
|
28
|
+
LogDrop.init({ appId: "your-app-id", apiKey: "your-api-key" });
|
|
29
|
+
</script>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Push notifications
|
|
33
|
+
|
|
34
|
+
Copy the exported `logdrop-sw.js` file to the website's own public directory, then configure its URL:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
LogDrop.init({
|
|
38
|
+
appId: "your-app-id",
|
|
39
|
+
apiKey: "your-api-key",
|
|
40
|
+
serviceWorkerUrl: "/logdrop-sw.js",
|
|
41
|
+
serviceWorkerScope: "/",
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If the application already manages a service worker, register the compatible worker first and provide its registration with `serviceWorkerRegistration`.
|
|
46
|
+
|
|
47
|
+
The SDK runs in the browser. A PHP, Python, Spring, or .NET application can include it in the HTML it serves, but server-side logs require a separate server SDK.
|