Edoardo Luppi
01/23/2024, 2:57 PMJsValue
, I get a strange compiled result. E.g.;
val remainingBytes = bytes.slice(index + delimiterBytes.size)
socket.unshift(remainingBytes, BufferEncoding.binary)
Becomes:
var remainingBytes = bytes.slice(index + this_1.length | 0);
0;
this._this__u8e3s4__1.socket_1.unshift(remainingBytes, 'binary');
Note the 0;
When I use:
val remainingBytes = bytes.slice(index + delimiterBytes.size)
socket.unshift(remainingBytes, "binary".unsafeCast<BufferEncoding>())
It correctly compiles to:
var remainingBytes = bytes.slice(index + this_1.length | 0);
this._this__u8e3s4__1.socket_1.unshift(remainingBytes, 'binary');
Do you recognize if it is indeed a Seskar bug?
Other example:
0;
this.this$0__1.socket_1.once('close', closeHandler);
0;
this.this$0__1.socket_1.once('end', endHandler);
0;
this.this$0__1.socket_1.once('error', errorHandler);
0;
this.this$0__1.socket_1.on('readable', readableHandler);
turansky
01/23/2024, 3:15 PMturansky
01/23/2024, 3:16 PM0;
is replacement for companion initializationturansky
01/23/2024, 3:19 PM@JsName("0")
to avoid call errors.
cc @Artem KobzarEdoardo Luppi
01/23/2024, 3:38 PMEdoardo Luppi
01/23/2024, 3:40 PMsealed external interface ReadableEvent : node.events.EventType {
sealed interface CLOSE : ReadableEvent
...
companion object {
@seskar.js.JsValue("close")
val CLOSE: CLOSE
The 0
represents the companion object
?