-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathJSRuntime.cs
More file actions
648 lines (549 loc) · 28.9 KB
/
JSRuntime.cs
File metadata and controls
648 lines (549 loc) · 28.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Microsoft.JavaScript.NodeApi.Runtime;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using static NodejsRuntime;
/// <summary>
/// Abstract base class for a JavaScript runtime.
/// </summary>
/// <remarks>
/// This is a mid-level API; it is lower level than JSValue and related types and methods, while
/// it is higher level than the napi_* native functions.
///
/// This middle layer serves two purposes:
/// 1. It is used to implement all of the higher level APIs in the library, while encapsulating
/// tedious concerns of dynamic function binding, memory pinning, string encoding, etc.
/// 2. It allows swapping out the runtime implementation, either for testing with mocks
/// or for using a JS runtime other than Node.js. (Other runtimes must implement the Node API.)
///
/// Guidelines for this API:
/// - Use .NET style method names, not napi_* function naming
/// - Prefer strings, Span, and nint over pointers
/// - Prefer ref and out over pointers, when practical
/// - Use napi_value instead of JSValue, JSObject, JSArray, etc.
/// - Do not throw exceptions; return status codes instead
/// - Avoid overloads that are purely for convenience
/// - GC handles should be managed at a higher layer; implementations of these APIs should
/// not allocate or dereference GC handles
///
/// The base methods all have default implementations that throw
/// <see cref="NotSupportedException"/>. This makes it easier to create runtime classes
/// (or test mocks) that implement only part of the API surface.
/// </remarks>
public abstract partial class JSRuntime
{
private static NotSupportedException NS([CallerMemberName] string name = "")
=> new($"The {name} method is not supported by the current JS runtime.");
public virtual bool IsAvailable(string functionName) => true;
public virtual napi_status GetVersion(napi_env env, out uint result) => throw NS();
public virtual napi_status RunScript(napi_env env, napi_value script, out napi_value result) => throw NS();
public virtual napi_status AddFinalizer(
napi_env env,
napi_value value,
nint finalizeData,
napi_finalize finalizeCallback,
nint finalizeHint,
out napi_ref result) => throw NS();
public virtual napi_status AddFinalizer(
napi_env env,
napi_value value,
nint finalizeData,
napi_finalize finalizeCallback,
nint finalizeHint) => throw NS();
public virtual napi_status AdjustExternalMemory(
napi_env env, long changeInBytes, out long result) => throw NS();
#region Instance data
public virtual napi_status GetInstanceData(
napi_env env,
out nint result) => throw NS();
public virtual napi_status SetInstanceData(
napi_env env,
nint data,
napi_finalize finalizeCallback,
nint finalizeHint) => throw NS();
#endregion
#region Error handling
public virtual napi_status CreateError(napi_env env, napi_value code, napi_value msg, out napi_value result) => throw NS();
public virtual napi_status CreateTypeError(
napi_env env,
napi_value code,
napi_value msg,
out napi_value result) => throw NS();
public virtual napi_status CreateRangeError(
napi_env env,
napi_value code,
napi_value msg,
out napi_value result) => throw NS();
public virtual napi_status CreateSyntaxError(
napi_env env,
napi_value code,
napi_value msg,
out napi_value result) => throw NS();
public virtual napi_status Throw(napi_env env, napi_value error) => throw NS();
public virtual napi_status ThrowError(napi_env env, string? code, string msg) => throw NS();
public virtual napi_status ThrowTypeError(napi_env env, string? code, string msg) => throw NS();
public virtual napi_status ThrowRangeError(napi_env env, string? code, string msg) => throw NS();
public virtual napi_status ThrowSyntaxError(napi_env env, string? code, string msg) => throw NS();
public virtual napi_status IsExceptionPending(napi_env env, out bool result) => throw NS();
public virtual napi_status GetLastErrorInfo(napi_env env, out napi_extended_error_info? result) => throw NS();
public virtual napi_status GetAndClearLastException(napi_env env, out napi_value result) => throw NS();
#endregion
#region Value type checking
public virtual napi_status GetValueType(napi_env env, napi_value value, out napi_valuetype result) => throw NS();
public virtual napi_status IsDate(napi_env env, napi_value value, out bool result) => throw NS();
public virtual napi_status IsPromise(napi_env env, napi_value value, out bool result) => throw NS();
public virtual napi_status IsError(napi_env env, napi_value value, out bool result) => throw NS();
public virtual napi_status IsArray(napi_env env, napi_value value, out bool result) => throw NS();
public virtual napi_status IsArrayBuffer(napi_env env, napi_value value, out bool result) => throw NS();
public virtual napi_status IsDetachedArrayBuffer(napi_env env, napi_value value, out bool result) => throw NS();
public virtual napi_status IsTypedArray(napi_env env, napi_value value, out bool result) => throw NS();
public virtual napi_status IsDataView(napi_env env, napi_value value, out bool result) => throw NS();
#endregion
#region Value retrieval
public virtual napi_status GetValueDouble(napi_env env, napi_value value, out double result) => throw NS();
public virtual napi_status GetValueInt32(napi_env env, napi_value value, out int result) => throw NS();
public virtual napi_status GetValueUInt32(napi_env env, napi_value value, out uint result) => throw NS();
public virtual napi_status GetValueInt64(napi_env env, napi_value value, out long result) => throw NS();
public virtual napi_status GetValueBigInt64(napi_env env, napi_value value, out long result, out bool lossless) => throw NS();
public virtual napi_status GetValueBigInt64(napi_env env, napi_value value, out ulong result, out bool lossless) => throw NS();
public virtual napi_status GetBigIntWordCount(napi_env env, napi_value value, out nuint result) => throw NS();
public virtual napi_status GetBigIntWords(napi_env env, napi_value value, out int sign, Span<ulong> words, out nuint result) => throw NS();
public virtual napi_status GetValueBool(napi_env env, napi_value value, out bool result) => throw NS();
public virtual napi_status GetValueStringUtf8(napi_env env, napi_value value, Span<byte> buf, out nuint result) => throw NS();
public virtual napi_status GetValueStringUtf16(napi_env env, napi_value value, Span<char> buf, out nuint result) => throw NS();
public virtual napi_status GetValueDate(napi_env env, napi_value value, out double result) => throw NS();
public virtual napi_status GetSymbolFor(napi_env env, string name, out napi_value result) => throw NS();
public virtual napi_status GetArrayLength(napi_env env, napi_value value, out uint result) => throw NS();
public virtual napi_status GetArrayBufferInfo(
napi_env env, napi_value value, out nint data, out nuint length) => throw NS();
public virtual napi_status GetTypedArrayInfo(
napi_env env,
napi_value value,
out napi_typedarray_type type,
out nuint byteLength,
out nint data,
out napi_value arraybuffer,
out nuint offset) => throw NS();
public virtual napi_status GetDataViewInfo(
napi_env env,
napi_value value,
out nuint byteLength,
out nint data,
out napi_value arraybuffer,
out nuint offset) => throw NS();
public virtual napi_status GetValueArrayBuffer(napi_env env, napi_value arraybuffer, out nint data) => throw NS();
public virtual napi_status GetValueTypedArray(
napi_env env,
napi_value typedarray,
out napi_typedarray_type type,
out nint data,
out napi_value arraybuffer,
out nuint byte_offset) => throw NS();
public virtual napi_status GetValueDataView(
napi_env env,
napi_value dataview,
out nint data,
out napi_value arraybuffer,
out nuint byte_offset) => throw NS();
public virtual napi_status GetValueExternal(napi_env env, napi_value value, out nint result) => throw NS();
public virtual napi_status StrictEquals(napi_env env, napi_value lhs, napi_value rhs, out bool result) => throw NS();
#endregion
#region Value creation
public virtual napi_status GetGlobal(napi_env env, out napi_value result) => throw NS();
public virtual napi_status GetUndefined(napi_env env, out napi_value result) => throw NS();
public virtual napi_status GetNull(napi_env env, out napi_value result) => throw NS();
public virtual napi_status GetBoolean(napi_env env, bool value, out napi_value result) => throw NS();
public virtual napi_status CreateNumber(napi_env env, double value, out napi_value result) => throw NS();
public virtual napi_status CreateNumber(napi_env env, int value, out napi_value result) => throw NS();
public virtual napi_status CreateNumber(napi_env env, uint value, out napi_value result) => throw NS();
public virtual napi_status CreateNumber(napi_env env, long value, out napi_value result) => throw NS();
public virtual napi_status CreateBigInt(napi_env env, long value, out napi_value result) => throw NS();
public virtual napi_status CreateBigInt(napi_env env, ulong value, out napi_value result) => throw NS();
public virtual napi_status CreateBigInt(napi_env env, int sign, ReadOnlySpan<ulong> words, out napi_value result) => throw NS();
public virtual napi_status CreateString(napi_env env, ReadOnlySpan<byte> utf8Str, out napi_value result) => throw NS();
public virtual napi_status CreateString(napi_env env, ReadOnlySpan<char> utf16Str, out napi_value result) => throw NS();
public virtual napi_status CreateDate(napi_env env, double time, out napi_value result) => throw NS();
public virtual napi_status CreateSymbol(napi_env env, napi_value description, out napi_value result) => throw NS();
public virtual napi_status CreateObject(napi_env env, out napi_value result) => throw NS();
public virtual napi_status CreateArray(napi_env env, out napi_value result) => throw NS();
public virtual napi_status CreateArray(napi_env env, uint length, out napi_value result) => throw NS();
public virtual napi_status CreateArrayBuffer(
napi_env env,
nuint byte_length,
out nint data,
out napi_value result) => throw NS();
public virtual napi_status CreateArrayBuffer(
napi_env env,
nint external_data,
nuint byte_length,
napi_finalize finalize_cb,
nint finalize_hint,
out napi_value result) => throw NS();
public virtual napi_status DetachArrayBuffer(napi_env env, napi_value arraybuffer) => throw NS();
public virtual napi_status CreateTypedArray(
napi_env env,
napi_typedarray_type type,
nuint length,
napi_value arraybuffer,
nuint byte_offset,
out napi_value result) => throw NS();
public virtual napi_status CreateDataView(
napi_env env,
nuint length,
napi_value arraybuffer,
nuint byte_offset,
out napi_value result) => throw NS();
public virtual napi_status CreateExternal(
napi_env env,
nint data,
napi_finalize finalize_cb,
nint finalize_hint,
out napi_value result) => throw NS();
public virtual napi_status CreateFunction(
napi_env env,
string? name,
napi_callback cb,
nint data,
out napi_value result) => throw NS();
public virtual napi_status CreatePromise(napi_env env, out napi_deferred deferred, out napi_value promise) => throw NS();
public virtual napi_status ResolveDeferred(napi_env env, napi_deferred deferred, napi_value resolution) => throw NS();
public virtual napi_status RejectDeferred(napi_env env, napi_deferred deferred, napi_value rejection) => throw NS();
#endregion
#region Value coercion
public virtual napi_status CoerceToBool(napi_env env, napi_value value, out napi_value result) => throw NS();
public virtual napi_status CoerceToNumber(napi_env env, napi_value value, out napi_value result) => throw NS();
public virtual napi_status CoerceToObject(napi_env env, napi_value value, out napi_value result) => throw NS();
public virtual napi_status CoerceToString(napi_env env, napi_value value, out napi_value result) => throw NS();
#endregion
#region Handle scopes
public virtual napi_status OpenHandleScope(napi_env env, out napi_handle_scope result) => throw NS();
public virtual napi_status CloseHandleScope(napi_env env, napi_handle_scope scope) => throw NS();
public virtual napi_status OpenEscapableHandleScope(
napi_env env,
out napi_escapable_handle_scope result) => throw NS();
public virtual napi_status CloseEscapableHandleScope(napi_env env, napi_escapable_handle_scope scope) => throw NS();
public virtual napi_status EscapeHandle(
napi_env env,
napi_escapable_handle_scope scope,
napi_value escapee,
out napi_value result) => throw NS();
#endregion
#region References
public virtual napi_status CreateReference(
napi_env env,
napi_value value,
uint initialRefcount,
out napi_ref result) => throw NS();
public virtual napi_status DeleteReference(napi_env env, napi_ref @ref) => throw NS();
public virtual napi_status RefReference(napi_env env, napi_ref @ref, out uint result) => throw NS();
public virtual napi_status UnrefReference(napi_env env, napi_ref @ref, out uint result) => throw NS();
public virtual napi_status GetReferenceValue(napi_env env, napi_ref @ref, out napi_value result) => throw NS();
#endregion
#region Function calls
public virtual napi_status CallFunction(
napi_env env,
napi_value recv,
napi_value func,
ReadOnlySpan<napi_value> args,
out napi_value result) => throw NS();
public virtual napi_status GetCallbackInfo(
napi_env env,
napi_callback_info cbinfo,
out nuint argc,
out nint data) => throw NS();
public virtual napi_status GetCallbackArgs(
napi_env env,
napi_callback_info cbinfo,
Span<napi_value> args,
out napi_value this_arg) => throw NS();
public virtual napi_status GetNewTarget(
napi_env env,
napi_callback_info cbinfo,
out napi_value result) => throw NS();
#endregion
#region Object properties
public virtual napi_status HasProperty(
napi_env env, napi_value js_object, napi_value key, out bool result) => throw NS();
public virtual napi_status HasOwnProperty(
napi_env env, napi_value js_object, napi_value key, out bool result) => throw NS();
public virtual napi_status GetProperty(
napi_env env, napi_value js_object, napi_value key, out napi_value result) => throw NS();
public virtual napi_status SetProperty(
napi_env env, napi_value js_object, napi_value key, napi_value value) => throw NS();
public virtual napi_status DeleteProperty(
napi_env env, napi_value js_object, napi_value key, out bool result) => throw NS();
public virtual napi_status HasNamedProperty(
napi_env env, napi_value js_object, ReadOnlySpan<byte> utf8name, out bool result) => throw NS();
public virtual napi_status GetNamedProperty(
napi_env env, napi_value js_object, ReadOnlySpan<byte> utf8name, out napi_value result) => throw NS();
public virtual napi_status SetNamedProperty(
napi_env env, napi_value js_object, ReadOnlySpan<byte> utf8name, napi_value value) => throw NS();
public virtual napi_status HasElement(
napi_env env, napi_value js_object, uint index, out bool result) => throw NS();
public virtual napi_status GetElement(
napi_env env, napi_value js_object, uint index, out napi_value result) => throw NS();
public virtual napi_status SetElement(
napi_env env, napi_value js_object, uint index, napi_value value) => throw NS();
public virtual napi_status DeleteElement(
napi_env env, napi_value js_object, uint index, out bool result) => throw NS();
#endregion
#region Property and class definition
public virtual napi_status GetPropertyNames(
napi_env env,
napi_value js_object,
out napi_value result) => throw NS();
public virtual napi_status GetAllPropertyNames(
napi_env env,
napi_value js_object,
napi_key_collection_mode key_mode,
napi_key_filter key_filter,
napi_key_conversion key_conversion,
out napi_value result) => throw NS();
public virtual napi_status Freeze(napi_env env, napi_value value) => throw NS();
public virtual napi_status Seal(napi_env env, napi_value value) => throw NS();
public virtual napi_status DefineProperties(
napi_env env,
napi_value js_object,
ReadOnlySpan<napi_property_descriptor> properties) => throw NS();
public virtual napi_status DefineClass(
napi_env env,
string name,
napi_callback constructor,
nint data,
ReadOnlySpan<napi_property_descriptor> properties,
out napi_value result) => throw NS();
public virtual napi_status GetPrototype(
napi_env env,
napi_value js_object,
out napi_value result) => throw NS();
public virtual napi_status NewInstance(
napi_env env,
napi_value constructor,
ReadOnlySpan<napi_value> args,
out napi_value result) => throw NS();
public virtual napi_status InstanceOf(
napi_env env,
napi_value js_object,
napi_value constructor,
out bool result) => throw NS();
public virtual napi_status Wrap(
napi_env env,
napi_value js_object,
nint native_object,
napi_finalize finalize_cb,
nint finalize_hint,
out napi_ref result) => throw NS();
public virtual napi_status Wrap(
napi_env env,
napi_value js_object,
nint native_object,
napi_finalize finalize_cb,
nint finalize_hint) => throw NS();
public virtual napi_status Unwrap(napi_env env, napi_value js_object, out nint result) => throw NS();
public virtual napi_status RemoveWrap(napi_env env, napi_value js_object, out nint result) => throw NS();
public virtual napi_status SetObjectTypeTag(
napi_env env, napi_value value, Guid typeTag) => throw NS();
public virtual napi_status CheckObjectTypeTag(
napi_env env, napi_value value, Guid typeTag, out bool result) => throw NS();
#endregion
#region Thread-safe functions
public virtual napi_status CreateThreadSafeFunction(
napi_env env,
napi_value func,
napi_value asyncResource,
napi_value asyncResourceName,
int maxQueueSize,
int initialThreadCount,
nint threadFinalizeData,
napi_finalize threadFinalizeCallback,
nint context,
napi_threadsafe_function_call_js callJSCallback,
out napi_threadsafe_function result) => throw NS();
public virtual napi_status CallThreadSafeFunction(
napi_threadsafe_function func,
nint data,
napi_threadsafe_function_call_mode isBlocking) => throw NS();
public virtual napi_status GetThreadSafeFunctionContext(
napi_threadsafe_function func,
out nint result) => throw NS();
public virtual napi_status AcquireThreadSafeFunction(napi_threadsafe_function func) => throw NS();
public virtual napi_status ReleaseThreadSafeFunction(
napi_threadsafe_function func,
napi_threadsafe_function_release_mode mode) => throw NS();
public virtual napi_status RefThreadSafeFunction(napi_env env, napi_threadsafe_function func) => throw NS();
public virtual napi_status UnrefThreadSafeFunction(napi_env env, napi_threadsafe_function func) => throw NS();
#endregion
#region Async work
public virtual napi_status AsyncInit(
napi_env env,
napi_value asyncResource,
napi_value asyncResourceName,
out napi_async_context result) => throw NS();
public virtual napi_status AsyncDestroy(napi_env env, napi_async_context asyncContext) => throw NS();
public virtual napi_status CreateAsyncWork(
napi_env env,
napi_value asyncResource,
napi_value asyncResourceName,
napi_async_execute_callback execute,
napi_async_complete_callback complete,
nint data,
out napi_async_work result) => throw NS();
public virtual napi_status QueueAsyncWork(napi_env env, napi_async_work work) => throw NS();
public virtual napi_status DeleteAsyncWork(napi_env env, napi_async_work work) => throw NS();
public virtual napi_status CancelAsyncWork(napi_env env, napi_async_work work) => throw NS();
public virtual napi_status MakeCallback(
napi_env env,
napi_async_context asyncContext,
napi_value recv,
napi_value func,
Span<napi_value> args,
out napi_value result) => throw NS();
public virtual napi_status OpenCallbackScope(
napi_env env,
napi_value resourceObject,
napi_async_context asyncContext,
out napi_callback_scope result) => throw NS();
public virtual napi_status CloseCallbackScope(napi_env env, napi_callback_scope scope) => throw NS();
#endregion
#region Cleanup hooks
public virtual napi_status AddAsyncCleanupHook(
napi_env env,
napi_async_cleanup_hook hook,
nint arg,
out napi_async_cleanup_hook_handle result) => throw NS();
public virtual napi_status RemoveAsyncCleanupHook(napi_async_cleanup_hook_handle removeHandle) => throw NS();
public virtual napi_status AddEnvCleanupHook(napi_env env, napi_cleanup_hook func, nint arg) => throw NS();
public virtual napi_status RemoveEnvCleanupHook(napi_env env, napi_cleanup_hook func, nint arg) => throw NS();
#endregion
#region Buffers
public virtual napi_status IsBuffer(napi_env env, napi_value value, out bool result) => throw NS();
public virtual napi_status CreateBuffer(napi_env env, Span<byte> data, out napi_value result) => throw NS();
public virtual napi_status CreateBufferCopy(
napi_env env,
ReadOnlySpan<byte> data,
out nint resultData,
out napi_value result) => throw NS();
public virtual napi_status CreateExternalBuffer(
napi_env env,
Span<byte> data,
napi_finalize finalizeCallback,
nint finalizeHint,
out napi_value result) => throw NS();
public virtual napi_status GetBufferInfo(
napi_env env,
napi_value value,
out nint data,
out nuint length) => throw NS();
#endregion
#region Misc Node.js functions
[DoesNotReturn]
public virtual void FatalError(string location, string message) => throw NS();
public virtual napi_status FatalException(napi_env env, napi_value err) => throw NS();
public virtual napi_status GetUVEventLoop(napi_env env, out uv_loop_t result) => throw NS();
public virtual void RegisterModule(ref napi_module module) => throw NS();
public virtual napi_status GetModuleFileName(napi_env env, out string result) => throw NS();
public virtual napi_status GetNodeVersion(napi_env env, out napi_node_version result) => throw NS();
#endregion
#region Embedding
public virtual string EmbeddingGetLastErrorMessage() => throw NS();
public virtual void EmbeddingSetLastErrorMessage(ReadOnlySpan<char> message) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRunMain(
ReadOnlySpan<string> args,
node_embedding_platform_configure_callback configure_platform,
nint configure_platform_data,
node_embedding_runtime_configure_callback configure_runtime,
nint configure_runtime_data) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingCreatePlatform(
ReadOnlySpan<string> args,
node_embedding_platform_configure_callback configure_platform,
nint configure_platform_data,
out node_embedding_platform result) => throw NS();
public virtual NodeEmbeddingStatus
EmbeddingDeletePlatform(node_embedding_platform platform) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingPlatformConfigSetFlags(
node_embedding_platform_config platform_config,
NodeEmbeddingPlatformFlags flags) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingPlatformGetParsedArgs(
node_embedding_platform platform,
nint args_count,
nint args,
nint runtime_args_count,
nint runtime_args) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRunRuntime(
node_embedding_platform platform,
node_embedding_runtime_configure_callback configure_runtime,
nint configure_runtime_data) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingCreateRuntime(
node_embedding_platform platform,
node_embedding_runtime_configure_callback configure_runtime,
nint configure_runtime_data,
out node_embedding_runtime result) => throw NS();
public virtual NodeEmbeddingStatus
EmbeddingDeleteRuntime(node_embedding_runtime runtime) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeConfigSetNodeApiVersion(
node_embedding_runtime_config runtime_config,
int node_api_version) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeConfigSetFlags(
node_embedding_runtime_config runtime_config,
NodeEmbeddingRuntimeFlags flags) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeConfigSetArgs(
node_embedding_runtime_config runtime_config,
ReadOnlySpan<string> args,
ReadOnlySpan<string> runtime_args) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeConfigOnPreload(
node_embedding_runtime_config runtime_config,
node_embedding_runtime_preload_callback preload,
nint preload_data,
node_embedding_data_release_callback release_preload_data) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeConfigOnLoading(
node_embedding_runtime_config runtime_config,
node_embedding_runtime_loading_callback run_load,
nint load_data,
node_embedding_data_release_callback release_load_data) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeConfigOnLoaded(
node_embedding_runtime_config runtime_config,
node_embedding_runtime_loaded_callback handle_loaded,
nint handle_loaded_data,
node_embedding_data_release_callback release_handle_loaded_data) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeConfigAddModule(
node_embedding_runtime_config runtime_config,
ReadOnlySpan<char> module_name,
node_embedding_module_initialize_callback init_module,
nint init_module_data,
node_embedding_data_release_callback release_init_module_data,
int module_node_api_version) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeSetUserData(
node_embedding_runtime runtime,
nint user_data,
node_embedding_data_release_callback release_user_data) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeGetUserData(
node_embedding_runtime runtime,
out nint user_data) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeConfigSetTaskRunner(
node_embedding_runtime_config runtime_config,
node_embedding_task_post_callback post_task,
nint post_task_data,
node_embedding_data_release_callback release_post_task_data) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeRunEventLoop(
node_embedding_runtime runtime) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeTerminateEventLoop(
node_embedding_runtime runtime) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeRunOnceEventLoop(
node_embedding_runtime runtime, out bool hasMoreWork) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeRunNoWaitEventLoop(
node_embedding_runtime runtime, out bool hasMoreWork) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeRunNodeApi(
node_embedding_runtime runtime,
node_embedding_node_api_run_callback run_node_api,
nint run_node_api_data) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeOpenNodeApiScope(
node_embedding_runtime runtime,
out node_embedding_node_api_scope node_api_scope,
out napi_env env) => throw NS();
public virtual NodeEmbeddingStatus EmbeddingRuntimeCloseNodeApiScope(
node_embedding_runtime runtime,
node_embedding_node_api_scope node_api_scope) => throw NS();
#endregion
}