amark on master
ok ack + webrtc Merge branch 'master' of http:/… bump (ok ack + webrtc) @Draeder… (compare)
amark on master
websocket ../index to ./index (… (compare)
amark on master
PANIC tests + AXE get dedup + f… Merge branch 'master' of http:/… (compare)
amark on master
lib/ison: Use setTimeout instea… (compare)
console.log("testing get {'.': {'*': '2021/06'}} expecting output")
await gun.get('chat2').then();
await gun.get('chat2').get({'.': {'>': '2021/06'}}).map().once(s=>{
console.log ("data",s);
t.notEqual(s,undefined,"s was not undefined");
}).then()
testing get {'.': {'*': '2021/06'}} expecting output
data { _: { '#': 'chat2/2021/06/25 01:30:00' } }
ok 1 s was not undefined
data { _: { '#': 'chat2/2021/06/31 01:00:00' } }
ok 2 s was not undefined
data { _: { '#': 'chat2/2021/06/31 01:30:00' } }
ok 3 s was not undefined
data { _: { '#': 'chat2/2021/06' } }
ok 4 s was not undefined
data { _: { '#': 'chat2/2021/06/22 01:00:00' } }
ok 5 s was not undefined
data { _: { '#': 'chat2/2021/06/23 01:30:00' } }
ok 6 s was not undefined
data { _: { '#': 'chat2/2021/06/24 01:00:00' } }
ok 7 s was not undefined
# force test to end
ok 8 forcing test to end with process.exit
1..8
# tests 8
# pass 8
# ok
feedProviders.get(providerAddress.Algaddress).set(null);
I'm using gun to update a react page with a lot of user-editable elements that are synced across devices, and I'm noticing that it can sometimes take a while (30 - 90 seconds) to get to the latest version (it seems like it runs through a lot of the history). I would think that gun would locally cache calls to .get()?
Also would using .set() instead alleviate some of these issues? There are a lot of entries in there that are nulled or marked as deleted and it has to download the non-nulled versions first before deleting them making for a poor UX
I am trying to wrap my head around Lex, but the documentation does not describe what some of the characters used in the examples actually do, specifically #
, +
, and .
.
Here are some Lex examples pulled from the SEA certify docs, could someone please describe what the #
, +
, and .
characters do in this context?
{"*": "notifications", "+": "*"} // Path must start with "notifications", then Path or Key must contain Certificant's Pub (it's just (path||key).indexOf(pub)!=-1)
{"#": {"*": "inbox"}} // Path must start with "inbox". "get('inbox').get('Alice').get('secret').put('abc', null, cert)" and "get('inbox').get('Bob').get('sensitive').put('something', null, cert)" ARE ALL OK.
{"#": {"*": "project"}, ".": {"*": "Bob"}, {"+": "*"}} // Path must start with "project" and Key must start with "Bob", then Path or Key must contain Certificant's Pub.
"inbox/Bob" // Path must equal "inbox/Bob", it is a LEX exact match {"=":"inbox/Bob"}
["inbox", {"*":"projects", "+": "*"}, {"*":"employees"}] // an Array of rules. If any matches, continue.
null
. The solution to get rid of this is to use map()
; if the value is null
just manually returned undefined
so the callback is not triggered anymore. About the local storage, the 5MB limit is annoying, but IndexedDB is much much slower
const is_file = () => {
if (files && files[0] && files[0].size > 0) {
return true;
}
return false;
};
let prev = user.get("file");
function upload() {
if (files[0]) file = files[0];
if (is_file()) {
prev = prev.get(file.name).get("next");
reader = new FileReader();
upload_file(0);
}
}
function upload_file(start) {
var next_slice = start + slice_size + 1;
var blob = file.slice(start, next_slice);
reader.onloadend = function (e) {
if (next_slice <= file.size) {
prev.put({ data: e.target.result });
prev = prev.get("next");
upload_file(next_slice);
} else {
loading = false;
}
};
reader.readAsText(blob);
}```
var url = window.URL.createObjectURL(data);
console.log(data.size);
if (fileChunk) {
files = [
...files,
{
url: url,
name: k,
size: data.size,
},
];
}
});```
then
- well my example doesn't have return value described as it's from a generic job iterator, but you get the point
gun.js:1672 WebSocket connection to