1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-06 00:13:33 +00:00

Updated so 'Finish' is emitted when "Ready" is called, after 'End' is emitted;

This commit is contained in:
Bryan Roe
2019-02-08 15:25:38 -08:00
parent 52d0510e7b
commit 9697af5215

View File

@@ -150,6 +150,13 @@ void ILibDuktape_WritableStream_Ready(ILibDuktape_WritableStream *stream)
{
stream->EndSink(stream, stream->WriteSink_User);
}
duk_push_heapptr(stream->ctx, stream->obj); // [stream]
duk_get_prop_string(stream->ctx, -1, "emit"); // [stream][emit]
duk_swap_top(stream->ctx, -2); // [emit][this]
duk_push_string(stream->ctx, "finish"); // [emit][this][finish]
if (duk_pcall_method(stream->ctx, 1) != 0) { ILibDuktape_Process_UncaughtException(stream->ctx); }
duk_pop(stream->ctx); // ...
}
}
@@ -255,6 +262,13 @@ duk_ret_t ILibDuktape_WritableStream_End(duk_context *ctx)
{
// Continue with closing stream
if (stream->EndSink != NULL) { stream->EndSink(stream, stream->WriteSink_User); }
duk_push_heapptr(stream->ctx, stream->obj); // [stream]
duk_get_prop_string(stream->ctx, -1, "emit"); // [stream][emit]
duk_swap_top(stream->ctx, -2); // [emit][this]
duk_push_string(stream->ctx, "finish"); // [emit][this][finish]
if (duk_pcall_method(stream->ctx, 1) != 0) { ILibDuktape_Process_UncaughtException(stream->ctx); }
duk_pop(stream->ctx); // ...
}
return 0;