electrodb 0.11.0 → 0.11.1

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/browser.js ADDED
@@ -0,0 +1,53 @@
1
+ const ElectroDB = require("./index");
2
+ window.Prism = window.Prism || {};
3
+ const appDiv = document.getElementById('param-container');
4
+
5
+ function printToScreen(val) {
6
+ const innerHtml = appDiv.innerHTML;
7
+ // if (window.Prism) {
8
+ // console.log("fn", window.Prism.highlight, window.Prism.highlight.toString());
9
+ // console.log("window.Prism.languages.json", Object.keys(window.Prism.languages), window.Prism.languages.JSON);
10
+ // // appDiv.innerHTML = innerHtml + window.Prism.highlight(val, window.Prism.languages.json, 'json');
11
+ // } else {
12
+ // console.log("FUUUU", window, window.Prism);
13
+ // }
14
+ // appDiv.innerHTML = innerHtml + Prism.highlight(val, Prism.languages.json, 'json');
15
+ appDiv.innerHTML = innerHtml + `<hr><pre><code class="language-json">${val}</code></pre>`;
16
+ }
17
+
18
+ function clearScreen() {
19
+ appDiv.innerHTML = '';
20
+ }
21
+
22
+ class Entity extends ElectroDB.Entity {
23
+ constructor(...params) {
24
+ super(...params);
25
+ this.client = {};
26
+ }
27
+ _queryParams(state, config) {
28
+ const params = super._queryParams(state, config);
29
+ printToScreen(JSON.stringify(params, null, 4));
30
+ return params;
31
+ }
32
+
33
+ _params(state, config) {
34
+ // @ts-ignore
35
+ const params = super._params(state, config);
36
+ printToScreen(JSON.stringify(params, null, 4));
37
+ return params;
38
+ }
39
+
40
+ go(type, params) {
41
+ printToScreen(JSON.stringify(params, null, 4));
42
+ }
43
+ }
44
+
45
+ class Service extends ElectroDB.Service {}
46
+
47
+
48
+ window.ElectroDB = {
49
+ Entity,
50
+ Service,
51
+ printToScreen,
52
+ clearScreen
53
+ };