summaryrefslogtreecommitdiff
path: root/index.htm
diff options
context:
space:
mode:
Diffstat (limited to 'index.htm')
-rw-r--r--index.htm27
1 files changed, 14 insertions, 13 deletions
diff --git a/index.htm b/index.htm
index 2e3ebe8..f94bdca 100644
--- a/index.htm
+++ b/index.htm
@@ -43,7 +43,7 @@
text_buffer : text_buffer,
});
},
- current_time_in_milliseconds : () => { return BigInt(Date.now()); },
+ current_utc_time_in_milliseconds : () => { return BigInt(Date.now()); },
floor : Math.floor,
ceil : Math.ceil,
@@ -76,8 +76,6 @@
this.sound_buffer_address = program.exports.js_sound_buffer();
this.pixels_address = program.exports.js_pixels();
- this.max_drop_size = program.exports.js_max_drop_size();
- this.drop_address = program.exports.js_drop_buffer();
this.frames = new Float32Array(
this.memory_buffer,
@@ -160,8 +158,8 @@
if (this.program === undefined)
return;
- let address = this.program.exports.js_clipboard_buffer(ev.bytes.length);
- let len = this.program.exports.js_clipboard_size();
+ let address = this.program.exports.js_clipboard_text(ev.bytes.length);
+ let len = this.program.exports.js_clipboard_text_len();
new Uint8Array(this.memory_buffer, address, len).set(ev.bytes.subarray(0, len));
@@ -187,14 +185,19 @@
return;
for (let f of ev.files) {
- if (f.name.byteLength + f.data.byteLength > this.max_drop_size) {
+ let ok = this.program.exports.js_drop(f.name.byteLength + 1, f.data.byteLength);
+
+ if (ok == 0) {
console.error("File too big");
- continue;
+ break;
}
+ let name_address = this.program.exports.js_drop_name();
+ let data_address = this.program.exports.js_drop_data();
+
new Uint8Array(
this.memory_buffer,
- this.drop_address,
+ name_address,
f.name.byteLength
).set(
new Uint8Array(f.name)
@@ -202,13 +205,11 @@
new Uint8Array(
this.memory_buffer,
- this.drop_address + f.name.byteLength,
+ data_address,
f.data.byteLength
).set(
new Uint8Array(f.data)
);
-
- this.program.exports.js_drop(f.name.byteLength, f.data.byteLength);
}
},
};
@@ -275,8 +276,8 @@
wasm,
{
env : {
- write_clipboard_impl : () => {},
- current_time_in_milliseconds : () => {},
+ write_clipboard_impl : () => {},
+ current_utc_time_in_milliseconds : () => {},
floor : () => {},
ceil : () => {},