You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
await most likely already calls then() on whatever follows it, which is what probably changes the value assigned to a variable from a gun node to data.
Which means that x = await gun.get('foo').put(); /* do something with x */ is equivalent to gun.get('foo').put().then(x => { /* do something with x */})
This is all not including lib/then, which begs the question why does gun have then() included by default then?
When I include lib/then the behavior is similar except var x = await gun.get('foo').put() never resolves, i have to append then() for it all to work.
For other users (such as @Dletta ), the promise resolves to a GUN Node :
@danlugo92 maybe we should move this to the documentation (anybody can edit it at https://github.com/amark/gun/wiki/API ) until made consistent / officially supported / rigorously tested?
I'd like this to work, tho need somebody to help write tests for EVERY COMBINATION of uses (there are a lot of combos, even with just a tiny API surface), and ideally somebody who is willing to volunteer time to sit down/screenshare with me as I/we actually add/fix better support (which is very tedious and boring), then it has a much higher chance of actually happening.
await gun.get('foo').put()
varies its behavior for different users.For me it returns the data, which matches what the docs say: https://gun.eco/docs/API#-a-name-then-a-gun-then-cb-
await
most likely already callsthen()
on whatever follows it, which is what probably changes the value assigned to a variable from a gun node to data.Which means that
x = await gun.get('foo').put(); /* do something with x */
is equivalent togun.get('foo').put().then(x => { /* do something with x */})
This is all not including
lib/then
, which begs the question why does gun havethen()
included by default then?When I include
lib/then
the behavior is similar exceptvar x = await gun.get('foo').put()
never resolves, i have to appendthen()
for it all to work.For other users (such as @Dletta ), the promise resolves to a GUN Node :
yarn.lock:
The text was updated successfully, but these errors were encountered: