buzzcasting-storage 1.0.3 → 1.0.4
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 +42 -16
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This is a wrapper class to use multiple storage options with BuzzCasting.
|
|
4
4
|
|
|
5
|
+
BuzzCasting Social Media Wall & Dataviz [More info](https://www.touchflows.com/services-buzzcasting-social-media-wall/).
|
|
6
|
+
|
|
5
7
|
Currently supported are: Local Storage, Session Storage, IDB Keyval, Dexie, Window object
|
|
6
8
|
|
|
7
9
|
## Features
|
|
@@ -17,37 +19,61 @@ Currently supported are: Local Storage, Session Storage, IDB Keyval, Dexie, Wind
|
|
|
17
19
|
## Get started
|
|
18
20
|
|
|
19
21
|
Example call:
|
|
22
|
+
|
|
20
23
|
```js
|
|
21
|
-
import BuzzcastingStorageManager, {
|
|
24
|
+
import BuzzcastingStorageManager, {
|
|
25
|
+
IQuery,
|
|
26
|
+
IStorageManager,
|
|
27
|
+
IMessages,
|
|
28
|
+
} from "buzzcasting-storage";
|
|
22
29
|
|
|
23
30
|
const options: IStorageManager = {
|
|
24
|
-
app:
|
|
25
|
-
version:
|
|
26
|
-
token:
|
|
27
|
-
bearer:
|
|
28
|
-
storage:
|
|
29
|
-
moderation:
|
|
31
|
+
app: "my-subdomain",
|
|
32
|
+
version: "v4",
|
|
33
|
+
token: "meta",
|
|
34
|
+
bearer: "bearer_token",
|
|
35
|
+
storage: "dexie",
|
|
36
|
+
moderation: "none",
|
|
30
37
|
beforeTime: null,
|
|
31
38
|
delay: 0,
|
|
32
39
|
period: 0,
|
|
33
40
|
};
|
|
34
41
|
|
|
35
|
-
let storageManager = new BuzzcastingStorageManager(options)
|
|
42
|
+
let storageManager = new BuzzcastingStorageManager(options);
|
|
36
43
|
|
|
37
44
|
const query: IQuery = {
|
|
38
|
-
type:
|
|
39
|
-
dashboard:
|
|
40
|
-
widget:
|
|
41
|
-
}
|
|
45
|
+
type: "messages",
|
|
46
|
+
dashboard: "dashboard_id",
|
|
47
|
+
widget: "widget_id",
|
|
48
|
+
};
|
|
42
49
|
|
|
43
|
-
const data = storageManager.getMessages(query)
|
|
50
|
+
const data: IMessages = storageManager.getMessages(query);
|
|
44
51
|
```
|
|
45
52
|
|
|
46
53
|
This will initiate a call to the buzzcasting backoffice to retrieve results
|
|
47
54
|
|
|
48
|
-
|
|
55
|
+
The Storage Manager will carry out the API call for the subscriber, and send out a BroadcastChannel on `app` to inform the subcriber that it can retrieve new data. The broadcast channel facilitates its incorporation in for example a Web Worker.
|
|
49
56
|
|
|
50
|
-
|
|
57
|
+
```js
|
|
58
|
+
|
|
59
|
+
const broadcastChannel = new BroadcastChannel('my-subdomain')
|
|
60
|
+
|
|
61
|
+
broadcastChannel.onmessage = (messageEvent: MessageEvent) => {
|
|
62
|
+
this.actions(messageEvent)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
actions = (messageEvent: MessageEvent) => {
|
|
66
|
+
switch (messageEvent.data.event) {
|
|
67
|
+
case 'widget-update':
|
|
68
|
+
// handle update
|
|
69
|
+
this.widgetUpdated.emit(messageEvent.data.data)
|
|
70
|
+
break
|
|
71
|
+
default:
|
|
72
|
+
//console.log('[storage]', messageEvent.data)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
```
|
|
51
77
|
|
|
52
78
|
### Git Clone
|
|
53
79
|
|
|
@@ -55,7 +81,7 @@ This is a template repo. Click the green [Use this template](https://github.com/
|
|
|
55
81
|
git clone https://github.com/TouchFlows/buzzcasting-storage.git
|
|
56
82
|
cd buzzcasting-storage
|
|
57
83
|
pnpm install
|
|
58
|
-
|
|
84
|
+
````
|
|
59
85
|
|
|
60
86
|
## Usage
|
|
61
87
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "mark.tamis@touchflows.com"
|
|
6
6
|
},
|
|
7
7
|
"type": "module",
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.0.4",
|
|
9
9
|
"private": false,
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
@@ -19,6 +19,16 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite",
|
|
24
|
+
"build": "tsc && vite build",
|
|
25
|
+
"release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
|
|
26
|
+
"lint": "eslint . --fix",
|
|
27
|
+
"test": "vitest --run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest --coverage",
|
|
30
|
+
"prepare": "husky install"
|
|
31
|
+
},
|
|
22
32
|
"devDependencies": {
|
|
23
33
|
"@antfu/eslint-config": "^2.6.4",
|
|
24
34
|
"@commitlint/cli": "^18.6.0",
|
|
@@ -41,14 +51,5 @@
|
|
|
41
51
|
"dependencies": {
|
|
42
52
|
"dexie": "^3.2.5",
|
|
43
53
|
"idb-keyval": "^6.2.1"
|
|
44
|
-
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"dev": "vite",
|
|
47
|
-
"build": "tsc && vite build",
|
|
48
|
-
"release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
|
|
49
|
-
"lint": "eslint . --fix",
|
|
50
|
-
"test": "vitest --run",
|
|
51
|
-
"test:watch": "vitest",
|
|
52
|
-
"test:coverage": "vitest --coverage"
|
|
53
54
|
}
|
|
54
55
|
}
|