@@ -21,14 +21,12 @@ public sealed class NodeEmbeddingRuntime : IDisposable
2121{
2222 private bool _mustDeleteRuntime ; // Only delete runtime if it was created by calling Create.
2323
24- public static JSRuntime JSRuntime => NodeEmbedding . JSRuntime ;
25-
2624 public static unsafe NodeEmbeddingRuntime Create (
2725 NodeEmbeddingPlatform platform , NodeEmbeddingRuntimeSettings ? settings = null )
2826 {
2927 using FunctorRef < node_embedding_runtime_configure_callback > functorRef =
3028 CreateRuntimeConfigureFunctorRef ( settings ? . CreateConfigureRuntimeCallback ( ) ) ;
31- JSRuntime . EmbeddingCreateRuntime (
29+ NodeEmbedding . JSRuntime . EmbeddingCreateRuntime (
3230 platform . Handle ,
3331 functorRef . Callback ,
3432 functorRef . Data ,
@@ -48,14 +46,15 @@ private NodeEmbeddingRuntime(node_embedding_runtime runtime)
4846
4947 public static unsafe NodeEmbeddingRuntime FromHandle ( node_embedding_runtime runtime )
5048 {
51- JSRuntime . EmbeddingRuntimeGetUserData ( runtime , out nint userData ) . ThrowIfFailed ( ) ;
49+ NodeEmbedding . JSRuntime . EmbeddingRuntimeGetUserData ( runtime , out nint userData )
50+ . ThrowIfFailed ( ) ;
5251 if ( userData != default )
5352 {
5453 return ( NodeEmbeddingRuntime ) GCHandle . FromIntPtr ( userData ) . Target ! ;
5554 }
5655
5756 NodeEmbeddingRuntime result = new ( runtime ) ;
58- JSRuntime . EmbeddingRuntimeSetUserData (
57+ NodeEmbedding . JSRuntime . EmbeddingRuntimeSetUserData (
5958 runtime ,
6059 ( nint ) GCHandle . Alloc ( result ) ,
6160 new node_embedding_data_release_callback ( s_releaseRuntimeCallback ) )
@@ -68,7 +67,8 @@ public static unsafe void Run(
6867 {
6968 using FunctorRef < node_embedding_runtime_configure_callback > functorRef =
7069 CreateRuntimeConfigureFunctorRef ( settings ? . CreateConfigureRuntimeCallback ( ) ) ;
71- JSRuntime . EmbeddingRunRuntime ( platform . Handle , functorRef . Callback , functorRef . Data )
70+ NodeEmbedding . JSRuntime . EmbeddingRunRuntime (
71+ platform . Handle , functorRef . Callback , functorRef . Data )
7272 . ThrowIfFailed ( ) ;
7373 }
7474
@@ -85,36 +85,38 @@ public void Dispose()
8585 if ( IsDisposed || ! _mustDeleteRuntime ) return ;
8686 IsDisposed = true ;
8787
88- JSRuntime . EmbeddingDeleteRuntime ( Handle ) . ThrowIfFailed ( ) ;
88+ NodeEmbedding . JSRuntime . EmbeddingDeleteRuntime ( Handle ) . ThrowIfFailed ( ) ;
8989 }
9090
9191 public unsafe void RunEventLoop ( )
9292 {
9393 if ( IsDisposed ) throw new ObjectDisposedException ( nameof ( NodeEmbeddingRuntime ) ) ;
9494
95- JSRuntime . EmbeddingRuntimeRunEventLoop ( Handle ) . ThrowIfFailed ( ) ;
95+ NodeEmbedding . JSRuntime . EmbeddingRuntimeRunEventLoop ( Handle ) . ThrowIfFailed ( ) ;
9696 }
9797
9898 public unsafe void TerminateEventLoop ( )
9999 {
100100 if ( IsDisposed ) throw new ObjectDisposedException ( nameof ( NodeEmbeddingRuntime ) ) ;
101101
102- JSRuntime . EmbeddingRuntimeTerminateEventLoop ( Handle ) . ThrowIfFailed ( ) ;
102+ NodeEmbedding . JSRuntime . EmbeddingRuntimeTerminateEventLoop ( Handle ) . ThrowIfFailed ( ) ;
103103 }
104104
105105 public unsafe bool RunEventLoopOnce ( )
106106 {
107107 if ( IsDisposed ) throw new ObjectDisposedException ( nameof ( NodeEmbeddingRuntime ) ) ;
108108
109- JSRuntime . EmbeddingRuntimeRunOnceEventLoop ( Handle , out bool result ) . ThrowIfFailed ( ) ;
109+ NodeEmbedding . JSRuntime . EmbeddingRuntimeRunOnceEventLoop ( Handle , out bool result )
110+ . ThrowIfFailed ( ) ;
110111 return result ;
111112 }
112113
113114 public unsafe bool RunEventLoopNoWait ( )
114115 {
115116 if ( IsDisposed ) throw new ObjectDisposedException ( nameof ( NodeEmbeddingRuntime ) ) ;
116117
117- JSRuntime . EmbeddingRuntimeRunNoWaitEventLoop ( Handle , out bool result ) . ThrowIfFailed ( ) ;
118+ NodeEmbedding . JSRuntime . EmbeddingRuntimeRunNoWaitEventLoop ( Handle , out bool result )
119+ . ThrowIfFailed ( ) ;
118120 return result ;
119121 }
120122
@@ -124,7 +126,8 @@ public unsafe void RunNodeApi(RunNodeApiCallback runNodeApi)
124126
125127 using FunctorRef < node_embedding_node_api_run_callback > functorRef =
126128 CreateNodeApiRunFunctorRef ( runNodeApi ) ;
127- JSRuntime . EmbeddingRuntimeRunNodeApi ( Handle , functorRef . Callback , functorRef . Data )
129+ NodeEmbedding . JSRuntime . EmbeddingRuntimeRunNodeApi (
130+ Handle , functorRef . Callback , functorRef . Data )
128131 . ThrowIfFailed ( ) ;
129132 }
130133
@@ -152,7 +155,7 @@ private static unsafe NodeEmbeddingStatus ReleaseRuntimeCallbackAdapter(nint dat
152155 }
153156 catch ( Exception ex )
154157 {
155- JSRuntime . EmbeddingSetLastErrorMessage ( ex . Message . AsSpan ( ) ) ;
158+ NodeEmbedding . JSRuntime . EmbeddingSetLastErrorMessage ( ex . Message . AsSpan ( ) ) ;
156159 return NodeEmbeddingStatus . GenericError ;
157160 }
158161 }
0 commit comments