Rust implementation of NextGraph, a Decentralized and local-first web 3.0 ecosystem
https://nextgraph.org
byzantine-fault-tolerancecrdtsdappsdecentralizede2eeeventual-consistencyjson-ldlocal-firstmarkdownocapoffline-firstp2pp2p-networkprivacy-protectionrdfrich-text-editorself-hostedsemantic-websparqlweb3collaboration
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
550 B
25 lines
550 B
import { deepSignal, subscribeDeepMutations } from './dist/index.js';
|
|
|
|
const root = deepSignal({
|
|
mySet: new Set([
|
|
{ "@id": "obj1", value: 10 }
|
|
])
|
|
});
|
|
|
|
subscribeDeepMutations(root, (patches) => {
|
|
console.log('Patches:', JSON.stringify(patches, null, 2));
|
|
});
|
|
|
|
// Get the first entry from the set
|
|
const entries = root.mySet.values();
|
|
const firstEntry = entries.next().value;
|
|
|
|
console.log('First entry:', firstEntry);
|
|
console.log('Modifying value...');
|
|
|
|
// Modify it
|
|
firstEntry.value = 20;
|
|
|
|
setTimeout(() => {
|
|
console.log('Done');
|
|
}, 100);
|
|
|