Create a util.js.{h,c} from some common things.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3681 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-11-03 22:15:46 +00:00
parent 03a2367532
commit fde7fb4270
9 changed files with 129 additions and 155 deletions

View File

@ -52,11 +52,11 @@ var g_database = new Database('core');
async function test_following() {
try {
debug_print("I AM", await ssb.whoami());
print("I AM", await ssb.whoami());
var result = await followingDeep(g_database, [await ssb.whoami()], 1);
debug_print("following ", JSON.stringify(result));
print("following ", JSON.stringify(result));
} catch (e) {
debug_print("DOH", e, e.stack);
print("DOH", e, e.stack);
}
}
@ -91,7 +91,7 @@ ssb.registerConnectionsChanged(function(change, connection) {
g_wants_requests[connection.id].send_json(out_message);
}
} else {
debug_print("blobs.get", id);
print("blobs.get", id);
var received_bytes = 0;
var expected_bytes = message.message[id];
var buffer = new Uint8Array(expected_bytes);
@ -114,10 +114,10 @@ ssb.registerConnectionsChanged(function(change, connection) {
}
});
} else if (change == 'remove') {
debug_print('REMOVE', connection.id);
print('REMOVE', connection.id);
delete g_wants_requests[connection.id];
} else {
debug_print('CHANGE', change);
print('CHANGE', change);
}
});