Comparing version 0.2.2 to 0.2.3
@@ -27,2 +27,11 @@ let wasm; | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; | ||
@@ -47,11 +56,2 @@ | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
function isLikeNone(x) { | ||
@@ -347,2 +347,23 @@ return x === undefined || x === null; | ||
} | ||
/** | ||
* @returns {ContainerID} | ||
*/ | ||
get target() { | ||
const ret = wasm.event_target(this.ptr); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {any} | ||
*/ | ||
get path() { | ||
const ret = wasm.event_path(this.ptr); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {any} | ||
*/ | ||
get diff() { | ||
const ret = wasm.event_diff(this.ptr); | ||
return takeObject(ret); | ||
} | ||
} | ||
@@ -733,2 +754,83 @@ | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorolist_subscribe(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorolist_subscribeOnce(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeDeep(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorolist_subscribeDeep(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn, subscription) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorolist_unsubscribe(retptr, this.ptr, addBorrowedObject(txn), subscription); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
if (r1) { | ||
throw takeObject(r0); | ||
} | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
} | ||
@@ -859,2 +961,83 @@ | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.loromap_subscribe(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.loromap_subscribeOnce(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeDeep(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.loromap_subscribeDeep(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn, subscription) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.loromap_unsubscribe(retptr, this.ptr, addBorrowedObject(txn), subscription); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
if (r1) { | ||
throw takeObject(r0); | ||
} | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
} | ||
@@ -954,2 +1137,62 @@ | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorotext_subscribe(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorotext_subscribeOnce(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn, subscription) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorotext_unsubscribe(retptr, this.ptr, addBorrowedObject(txn), subscription); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
if (r1) { | ||
throw takeObject(r0); | ||
} | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
} | ||
@@ -1207,2 +1450,7 @@ | ||
export function __wbindgen_object_clone_ref(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
export function __wbindgen_cb_drop(arg0) { | ||
@@ -1245,7 +1493,2 @@ const obj = takeObject(arg0).original; | ||
export function __wbindgen_object_clone_ref(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
export function __wbg_lorotext_new(arg0) { | ||
@@ -1307,2 +1550,7 @@ const ret = LoroText.__wrap(arg0); | ||
export function __wbindgen_is_string(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'string'; | ||
return ret; | ||
}; | ||
export function __wbindgen_boolean_get(arg0) { | ||
@@ -1314,7 +1562,2 @@ const v = getObject(arg0); | ||
export function __wbindgen_is_string(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'string'; | ||
return ret; | ||
}; | ||
export function __wbindgen_number_new(arg0) { | ||
@@ -1474,7 +1717,2 @@ const ret = arg0; | ||
export function __wbg_has_3feea89d34bd7ad5() { return handleError(function (arg0, arg1) { | ||
const ret = Reflect.has(getObject(arg0), getObject(arg1)); | ||
return ret; | ||
}, arguments) }; | ||
export function __wbg_ownKeys_9efe69be404540aa() { return handleError(function (arg0) { | ||
@@ -1509,6 +1747,6 @@ const ret = Reflect.ownKeys(getObject(arg0)); | ||
export function __wbindgen_closure_wrapper225(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 31, __wbg_adapter_32); | ||
export function __wbindgen_closure_wrapper375(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 60, __wbg_adapter_32); | ||
return addHeapObject(ret); | ||
}; | ||
@@ -24,2 +24,5 @@ /* tslint:disable */ | ||
export function event_origin(a: number): number; | ||
export function event_target(a: number): number; | ||
export function event_path(a: number): number; | ||
export function event_diff(a: number): number; | ||
export function __wbg_transaction_free(a: number): void; | ||
@@ -32,2 +35,5 @@ export function transaction_commit(a: number, b: number): void; | ||
export function lorotext_length(a: number): number; | ||
export function lorotext_subscribe(a: number, b: number, c: number, d: number): void; | ||
export function lorotext_subscribeOnce(a: number, b: number, c: number, d: number): void; | ||
export function lorotext_unsubscribe(a: number, b: number, c: number, d: number): void; | ||
export function loromap_set(a: number, b: number, c: number, d: number, e: number, f: number): void; | ||
@@ -40,2 +46,6 @@ export function loromap_delete(a: number, b: number, c: number, d: number, e: number): void; | ||
export function loromap_insertContainer(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void; | ||
export function loromap_subscribe(a: number, b: number, c: number, d: number): void; | ||
export function loromap_subscribeOnce(a: number, b: number, c: number, d: number): void; | ||
export function loromap_subscribeDeep(a: number, b: number, c: number, d: number): void; | ||
export function loromap_unsubscribe(a: number, b: number, c: number, d: number): void; | ||
export function __wbg_lorolist_free(a: number): void; | ||
@@ -49,2 +59,6 @@ export function lorolist_insert(a: number, b: number, c: number, d: number, e: number): void; | ||
export function lorolist_insertContainer(a: number, b: number, c: number, d: number, e: number, f: number): void; | ||
export function lorolist_subscribe(a: number, b: number, c: number, d: number): void; | ||
export function lorolist_subscribeOnce(a: number, b: number, c: number, d: number): void; | ||
export function lorolist_subscribeDeep(a: number, b: number, c: number, d: number): void; | ||
export function lorolist_unsubscribe(a: number, b: number, c: number, d: number): void; | ||
export function __wbg_lorotext_free(a: number): void; | ||
@@ -51,0 +65,0 @@ export function __wbg_loromap_free(a: number): void; |
@@ -8,6 +8,5 @@ /* tslint:disable */ | ||
export type ContainerType = "Text" | "Map" | "List"; | ||
export type ContainerID = { id: string; type: ContainerType } | { | ||
root: string; | ||
type: ContainerType; | ||
}; | ||
export type ContainerID = | ||
| `/${string}:${ContainerType}` | ||
| `${number}@${number}:${ContainerType}`; | ||
@@ -26,2 +25,5 @@ interface Loro { | ||
*/ | ||
readonly diff: any; | ||
/** | ||
*/ | ||
local: boolean; | ||
@@ -31,2 +33,8 @@ /** | ||
readonly origin: string | undefined | undefined; | ||
/** | ||
*/ | ||
readonly path: any; | ||
/** | ||
*/ | ||
readonly target: ContainerID; | ||
} | ||
@@ -130,3 +138,26 @@ /** | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeDeep(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn: Transaction | Loro, subscription: number): void; | ||
/** | ||
*/ | ||
readonly id: ContainerID; | ||
@@ -170,3 +201,26 @@ /** | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeDeep(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn: Transaction | Loro, subscription: number): void; | ||
/** | ||
*/ | ||
readonly id: ContainerID; | ||
@@ -198,3 +252,20 @@ /** | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn: Transaction | Loro, subscription: number): void; | ||
/** | ||
*/ | ||
readonly id: ContainerID; | ||
@@ -201,0 +272,0 @@ /** |
@@ -24,2 +24,5 @@ /* tslint:disable */ | ||
export function event_origin(a: number): number; | ||
export function event_target(a: number): number; | ||
export function event_path(a: number): number; | ||
export function event_diff(a: number): number; | ||
export function __wbg_transaction_free(a: number): void; | ||
@@ -32,2 +35,5 @@ export function transaction_commit(a: number, b: number): void; | ||
export function lorotext_length(a: number): number; | ||
export function lorotext_subscribe(a: number, b: number, c: number, d: number): void; | ||
export function lorotext_subscribeOnce(a: number, b: number, c: number, d: number): void; | ||
export function lorotext_unsubscribe(a: number, b: number, c: number, d: number): void; | ||
export function loromap_set(a: number, b: number, c: number, d: number, e: number, f: number): void; | ||
@@ -40,2 +46,6 @@ export function loromap_delete(a: number, b: number, c: number, d: number, e: number): void; | ||
export function loromap_insertContainer(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void; | ||
export function loromap_subscribe(a: number, b: number, c: number, d: number): void; | ||
export function loromap_subscribeOnce(a: number, b: number, c: number, d: number): void; | ||
export function loromap_subscribeDeep(a: number, b: number, c: number, d: number): void; | ||
export function loromap_unsubscribe(a: number, b: number, c: number, d: number): void; | ||
export function __wbg_lorolist_free(a: number): void; | ||
@@ -49,2 +59,6 @@ export function lorolist_insert(a: number, b: number, c: number, d: number, e: number): void; | ||
export function lorolist_insertContainer(a: number, b: number, c: number, d: number, e: number, f: number): void; | ||
export function lorolist_subscribe(a: number, b: number, c: number, d: number): void; | ||
export function lorolist_subscribeOnce(a: number, b: number, c: number, d: number): void; | ||
export function lorolist_subscribeDeep(a: number, b: number, c: number, d: number): void; | ||
export function lorolist_unsubscribe(a: number, b: number, c: number, d: number): void; | ||
export function __wbg_lorotext_free(a: number): void; | ||
@@ -51,0 +65,0 @@ export function __wbg_loromap_free(a: number): void; |
@@ -8,6 +8,5 @@ /* tslint:disable */ | ||
export type ContainerType = "Text" | "Map" | "List"; | ||
export type ContainerID = { id: string; type: ContainerType } | { | ||
root: string; | ||
type: ContainerType; | ||
}; | ||
export type ContainerID = | ||
| `/${string}:${ContainerType}` | ||
| `${number}@${number}:${ContainerType}`; | ||
@@ -26,2 +25,5 @@ interface Loro { | ||
*/ | ||
readonly diff: any; | ||
/** | ||
*/ | ||
local: boolean; | ||
@@ -31,2 +33,8 @@ /** | ||
readonly origin: string | undefined | undefined; | ||
/** | ||
*/ | ||
readonly path: any; | ||
/** | ||
*/ | ||
readonly target: ContainerID; | ||
} | ||
@@ -130,3 +138,26 @@ /** | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeDeep(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn: Transaction | Loro, subscription: number): void; | ||
/** | ||
*/ | ||
readonly id: ContainerID; | ||
@@ -170,3 +201,26 @@ /** | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeDeep(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn: Transaction | Loro, subscription: number): void; | ||
/** | ||
*/ | ||
readonly id: ContainerID; | ||
@@ -198,3 +252,20 @@ /** | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn: Transaction | Loro, f: Function): number; | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn: Transaction | Loro, subscription: number): void; | ||
/** | ||
*/ | ||
readonly id: ContainerID; | ||
@@ -201,0 +272,0 @@ /** |
@@ -26,2 +26,11 @@ let imports = {}; | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
@@ -44,11 +53,2 @@ | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
function isLikeNone(x) { | ||
@@ -342,2 +342,23 @@ return x === undefined || x === null; | ||
} | ||
/** | ||
* @returns {ContainerID} | ||
*/ | ||
get target() { | ||
const ret = wasm.event_target(this.ptr); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {any} | ||
*/ | ||
get path() { | ||
const ret = wasm.event_path(this.ptr); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {any} | ||
*/ | ||
get diff() { | ||
const ret = wasm.event_diff(this.ptr); | ||
return takeObject(ret); | ||
} | ||
} | ||
@@ -730,2 +751,83 @@ module.exports.Event = Event; | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorolist_subscribe(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorolist_subscribeOnce(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeDeep(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorolist_subscribeDeep(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn, subscription) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorolist_unsubscribe(retptr, this.ptr, addBorrowedObject(txn), subscription); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
if (r1) { | ||
throw takeObject(r0); | ||
} | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
} | ||
@@ -857,2 +959,83 @@ module.exports.LoroList = LoroList; | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.loromap_subscribe(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.loromap_subscribeOnce(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeDeep(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.loromap_subscribeDeep(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn, subscription) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.loromap_unsubscribe(retptr, this.ptr, addBorrowedObject(txn), subscription); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
if (r1) { | ||
throw takeObject(r0); | ||
} | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
} | ||
@@ -953,2 +1136,62 @@ module.exports.LoroMap = LoroMap; | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribe(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorotext_subscribe(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {Function} f | ||
* @returns {number} | ||
*/ | ||
subscribeOnce(txn, f) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorotext_subscribeOnce(retptr, this.ptr, addBorrowedObject(txn), addHeapObject(f)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return r0 >>> 0; | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
/** | ||
* @param {Transaction | Loro} txn | ||
* @param {number} subscription | ||
*/ | ||
unsubscribe(txn, subscription) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.lorotext_unsubscribe(retptr, this.ptr, addBorrowedObject(txn), subscription); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
if (r1) { | ||
throw takeObject(r0); | ||
} | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
heap[stack_pointer++] = undefined; | ||
} | ||
} | ||
} | ||
@@ -1211,2 +1454,7 @@ module.exports.LoroText = LoroText; | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_cb_drop = function(arg0) { | ||
@@ -1249,7 +1497,2 @@ const obj = takeObject(arg0).original; | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_lorotext_new = function(arg0) { | ||
@@ -1311,2 +1554,7 @@ const ret = LoroText.__wrap(arg0); | ||
module.exports.__wbindgen_is_string = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'string'; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_boolean_get = function(arg0) { | ||
@@ -1318,7 +1566,2 @@ const v = getObject(arg0); | ||
module.exports.__wbindgen_is_string = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'string'; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_number_new = function(arg0) { | ||
@@ -1478,7 +1721,2 @@ const ret = arg0; | ||
module.exports.__wbg_has_3feea89d34bd7ad5 = function() { return handleError(function (arg0, arg1) { | ||
const ret = Reflect.has(getObject(arg0), getObject(arg1)); | ||
return ret; | ||
}, arguments) }; | ||
module.exports.__wbg_ownKeys_9efe69be404540aa = function() { return handleError(function (arg0) { | ||
@@ -1513,4 +1751,4 @@ const ret = Reflect.ownKeys(getObject(arg0)); | ||
module.exports.__wbindgen_closure_wrapper225 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 31, __wbg_adapter_32); | ||
module.exports.__wbindgen_closure_wrapper375 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 60, __wbg_adapter_32); | ||
return addHeapObject(ret); | ||
@@ -1517,0 +1755,0 @@ }; |
{ | ||
"name": "loro-wasm", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "nodejs/loro_wasm.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
3
2320777
16
4160