Add set() functionality
This commit is contained in:
parent
40db2cc97d
commit
58c3c73497
1 changed files with 11 additions and 1 deletions
|
|
@ -349,7 +349,17 @@ function createReplica(path, afterMap = false) {
|
||||||
if (afterMap) {
|
if (afterMap) {
|
||||||
throw new Error('Cannot call set() after map() on a GunSmith node')
|
throw new Error('Cannot call set() after map() on a GunSmith node')
|
||||||
}
|
}
|
||||||
return this
|
// @ts-expect-error
|
||||||
|
const uuid = Gun.text.random()
|
||||||
|
return this.put(
|
||||||
|
{
|
||||||
|
[uuid]: data
|
||||||
|
},
|
||||||
|
ack => {
|
||||||
|
// eslint-disable-next-line no-unused-expressions
|
||||||
|
cb && cb(ack)
|
||||||
|
}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
user(pub) {
|
user(pub) {
|
||||||
if (path !== '$root') {
|
if (path !== '$root') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue