<@U33H6SB2B> when I use a property marked with Ses...
# javascript
e
@turansky when I use a property marked with Seskar's
JsValue
, I get a strange compiled result. E.g.;
Copy code
val remainingBytes = bytes.slice(index + delimiterBytes.size)
socket.unshift(remainingBytes, BufferEncoding.binary)
Becomes:
Copy code
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:
Copy code
val remainingBytes = bytes.slice(index + delimiterBytes.size)
socket.unshift(remainingBytes, "binary".unsafeCast<BufferEncoding>())
It correctly compiles to:
Copy code
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:
Copy code
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);
t
> Do you recognize if it is indeed a Seskar bug? It's feature 😉
0;
is replacement for companion initialization
We have external interfaces with runtime and without. For now we have no instruments to mark interfaces without runtime and we use
@JsName("0")
to avoid call errors. cc @Artem Kobzar
e
Ahhhh! Thanks for the explanation, makes sense. Yeah it's a nice trick, but would be cool to get it to work without it.
So basically in this case
Copy code
sealed 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
?
👌 1