@converse/skeletor 0.0.5 → 0.0.6
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 +70 -7
- package/dist/skeletor.js +160 -160
- package/dist/skeletor.js.map +1 -1
- package/dist/skeletor.min.js +2 -2
- package/dist/skeletor.min.js.map +1 -1
- package/package.json +4 -3
- package/src/drivers/indexeddb-getitems.js~ +1116 -0
- package/src/drivers/indexeddb.js~ +1115 -0
- package/src/storage.js +11 -8
- package/src/storage.js~ +13 -9
- package/CHANGES.md +0 -37
- package/src/.events.js.swp +0 -0
- package/src/.helpers.js.swp +0 -0
- package/src/.history.js.swp +0 -0
- package/src/.model.js.swp +0 -0
- package/src/.overview.js.swp +0 -0
- package/src/.router.js.swp +0 -0
- package/src/.view.js.swp +0 -0
- package/src/collection.js~ +0 -737
- package/src/drivers/.sessionStorage.js.swp +0 -0
- package/src/drivers/sessionStorage.js~ +0 -316
- package/src/element-overview.js~ +0 -4
- package/src/element.js~ +0 -188
- package/src/events.js~ +0 -334
- package/src/helpers.js~ +0 -151
- package/src/history.js~ +0 -301
- package/src/htmlview.js~ +0 -14
- package/src/model.js~ +0 -439
- package/src/orderedlist.js~ +0 -88
- package/src/overview.js~ +0 -111
- package/src/router.js~ +0 -119
- package/src/vdomview.js~ +0 -15
- package/src/view.js~ +0 -267
package/src/storage.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* IndexedDB, localStorage and sessionStorage adapter
|
|
3
3
|
*/
|
|
4
|
-
import mergebounce from 'mergebounce';
|
|
5
|
-
import localForage from "localforage/src/localforage";
|
|
6
4
|
import * as memoryDriver from 'localforage-driver-memory';
|
|
7
5
|
import cloneDeep from 'lodash-es/cloneDeep.js';
|
|
8
6
|
import isString from 'lodash-es/isString.js';
|
|
7
|
+
import localForage from "localforage/src/localforage";
|
|
8
|
+
import mergebounce from 'mergebounce';
|
|
9
9
|
import sessionStorageWrapper from "./drivers/sessionStorage.js";
|
|
10
|
-
import { extendPrototype } from 'localforage-setitems';
|
|
10
|
+
import { extendPrototype as extendPrototypeWithSetItems } from 'localforage-setitems';
|
|
11
|
+
import { extendPrototype as extendPrototypeWithGetItems } from 'localforage-getitems';
|
|
11
12
|
|
|
12
13
|
const IN_MEMORY = memoryDriver._driver
|
|
13
14
|
localForage.defineDriver(memoryDriver);
|
|
14
|
-
|
|
15
|
+
extendPrototypeWithSetItems(localForage);
|
|
16
|
+
extendPrototypeWithGetItems(localForage);
|
|
15
17
|
|
|
16
18
|
function S4() {
|
|
17
19
|
// Generate four random hex digits.
|
|
@@ -80,7 +82,7 @@ class Storage {
|
|
|
80
82
|
await Promise.all(removed_keys.map(k => this.store.removeItem(k).catch(e => console.error(e))));
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
sync (
|
|
85
|
+
sync () {
|
|
84
86
|
const that = this;
|
|
85
87
|
|
|
86
88
|
async function localSync (method, model, options) {
|
|
@@ -237,9 +239,10 @@ class Storage {
|
|
|
237
239
|
async findAll () {
|
|
238
240
|
/* Return the array of all models currently in storage.
|
|
239
241
|
*/
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
|
|
242
|
+
const keys = await this.store.getItem(this.name);
|
|
243
|
+
if (keys?.length) {
|
|
244
|
+
const items = await this.store.getItems(keys);
|
|
245
|
+
return Object.values(items);
|
|
243
246
|
}
|
|
244
247
|
return [];
|
|
245
248
|
}
|
package/src/storage.js~
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* IndexedDB, localStorage and sessionStorage adapter
|
|
3
3
|
*/
|
|
4
|
-
import mergebounce from 'mergebounce';
|
|
5
|
-
import * as localForage from "localforage";
|
|
6
4
|
import * as memoryDriver from 'localforage-driver-memory';
|
|
7
5
|
import cloneDeep from 'lodash-es/cloneDeep.js';
|
|
8
6
|
import isString from 'lodash-es/isString.js';
|
|
7
|
+
import localForage from "localforage/src/localforage";
|
|
8
|
+
import mergebounce from 'mergebounce';
|
|
9
9
|
import sessionStorageWrapper from "./drivers/sessionStorage.js";
|
|
10
|
-
import { extendPrototype } from 'localforage-setitems';
|
|
10
|
+
import { extendPrototype as extendPrototypeWithSetItems } from 'localforage-setitems';
|
|
11
|
+
import { extendPrototype as extendPrototypeWithGetItems } from 'localforage-getitems';
|
|
11
12
|
|
|
12
13
|
const IN_MEMORY = memoryDriver._driver
|
|
13
14
|
localForage.defineDriver(memoryDriver);
|
|
14
|
-
|
|
15
|
+
extendPrototypeWithSetItems(localForage);
|
|
16
|
+
extendPrototypeWithGetItems(localForage);
|
|
15
17
|
|
|
16
18
|
function S4() {
|
|
17
19
|
// Generate four random hex digits.
|
|
@@ -80,7 +82,7 @@ class Storage {
|
|
|
80
82
|
await Promise.all(removed_keys.map(k => this.store.removeItem(k).catch(e => console.error(e))));
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
sync (
|
|
85
|
+
sync () {
|
|
84
86
|
const that = this;
|
|
85
87
|
|
|
86
88
|
async function localSync (method, model, options) {
|
|
@@ -187,7 +189,7 @@ class Storage {
|
|
|
187
189
|
|
|
188
190
|
getCollectionReferenceData (model) {
|
|
189
191
|
if (!model.collection) {
|
|
190
|
-
return;
|
|
192
|
+
return {};
|
|
191
193
|
}
|
|
192
194
|
const ids = model.collection.map(m => this.getItemName(m.id));
|
|
193
195
|
const new_id = this.getItemName(model.id);
|
|
@@ -237,9 +239,11 @@ class Storage {
|
|
|
237
239
|
async findAll () {
|
|
238
240
|
/* Return the array of all models currently in storage.
|
|
239
241
|
*/
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
|
|
242
|
+
const keys = await this.store.getItem(this.name);
|
|
243
|
+
if (keys?.length) {
|
|
244
|
+
const items = await this.store.getItems(keys);
|
|
245
|
+
debugger;
|
|
246
|
+
return Object.values(items);
|
|
243
247
|
}
|
|
244
248
|
return [];
|
|
245
249
|
}
|
package/CHANGES.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 0.0.5 (2021-07-08)
|
|
4
|
-
|
|
5
|
-
- #13 Import the default export of localforage
|
|
6
|
-
- Don't expect a collection's `model` attribute to have a `prototype`. It might be an arrow function, in which case it doesn't.
|
|
7
|
-
- Update to mergebounce 0.1.0
|
|
8
|
-
|
|
9
|
-
## 0.0.4 (2021-05-12)
|
|
10
|
-
|
|
11
|
-
- Upgrade to lit 2.0.0-rc.2
|
|
12
|
-
|
|
13
|
-
## 0.0.3 (2021-04-28)
|
|
14
|
-
|
|
15
|
-
- Create the `ElementView`, which is like a Backbone View but extends
|
|
16
|
-
`HTMLElement` and is therefore also a custom element or web component.
|
|
17
|
-
/home/kalie/src/converse.prosody/src/converse.js/src/headless/core.js: * @property {object} converse.env._ - The instance of [lodash-es](http://lodash.com) used by Converse.
|
|
18
|
-
- Allow writes to the client-side store to be batched (via [mergebounce](https://github.com/conversejs/mergebounce)).
|
|
19
|
-
This is particularly useful for IndexedDB, which has a very slow writing speed.
|
|
20
|
-
To enabled batched writes, pass in `true` for the 3rd parameter of the
|
|
21
|
-
`Storage` constructor.
|
|
22
|
-
|
|
23
|
-
## 0.0.2 (2020-09-18)
|
|
24
|
-
|
|
25
|
-
Initial fork from Backbone
|
|
26
|
-
|
|
27
|
-
- Removes the dependency on jQuery
|
|
28
|
-
- Instead of the `render` method Views can have a `toHTML` method which must return a
|
|
29
|
-
[lit-html](https://lit-html.polymer-project.org/) `TemplateResult`.
|
|
30
|
-
- Replaces [underscore](http://underscorejs.org) with [lodash](https://lodash.com)
|
|
31
|
-
- Imports lodash methods individually to allow for tree-shaking
|
|
32
|
-
- Uses the native browser API instead of lodash
|
|
33
|
-
- Drops support for older browsers (including IE) and uses ES6+ language features
|
|
34
|
-
- Splits models, views and collections into separate modules
|
|
35
|
-
- Adds a new `ElementView` class, which is a like a Backbone View, but doubles
|
|
36
|
-
as an instance of HTMLElement and can be used to register a custom element or
|
|
37
|
-
web-component.
|
package/src/.events.js.swp
DELETED
|
Binary file
|
package/src/.helpers.js.swp
DELETED
|
Binary file
|
package/src/.history.js.swp
DELETED
|
Binary file
|
package/src/.model.js.swp
DELETED
|
Binary file
|
package/src/.overview.js.swp
DELETED
|
Binary file
|
package/src/.router.js.swp
DELETED
|
Binary file
|
package/src/.view.js.swp
DELETED
|
Binary file
|