Skip to content

Commit 1a5520d

Browse files
authored
Merge pull request #80 from lightpanda-io/SetHostInitializeImportMetaObjectCallback
Expose Isolate's SetHostInitializeImportMetaObjectCallback
2 parents 23718cd + 46ddf8c commit 1a5520d

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/binding.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,12 @@ void v8__Isolate__SetHostImportModuleDynamicallyCallback(
303303
isolate->SetHostImportModuleDynamicallyCallback(callback);
304304
}
305305

306+
void v8__Isolate__SetHostInitializeImportMetaObjectCallback(
307+
v8::Isolate* isolate,
308+
v8::HostInitializeImportMetaObjectCallback callback) {
309+
isolate->SetHostInitializeImportMetaObjectCallback(callback);
310+
}
311+
306312
void v8__Isolate__SetPromiseRejectCallback(
307313
v8::Isolate* isolate,
308314
v8::PromiseRejectCallback callback) {

src/binding.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ typedef enum PromiseRejectEvent {
7777
typedef struct PromiseRejectMessage PromiseRejectMessage;
7878
typedef void (*PromiseRejectCallback)(PromiseRejectMessage);
7979
typedef Promise* (*HostImportModuleDynamicallyCallback)(Context*, Data*, Value*, String*, FixedArray*);
80+
typedef void (*HostInitializeImportMetaObjectCallback)(Context*, Module*, Data*);
8081
typedef enum MessageErrorLevel {
8182
kMessageLog = (1 << 0),
8283
kMessageDebug = (1 << 1),
@@ -215,6 +216,9 @@ const Value* v8__Isolate__ThrowException(
215216
void v8__Isolate__SetHostImportModuleDynamicallyCallback(
216217
Isolate* isolate,
217218
HostImportModuleDynamicallyCallback callback);
219+
void v8__Isolate__SetHostInitializeImportMetaObjectCallback(
220+
Isolate* isolate,
221+
HostInitializeImportMetaObjectCallback callback);
218222
void v8__Isolate__SetPromiseRejectCallback(
219223
Isolate* isolate,
220224
PromiseRejectCallback callback);

src/v8.zig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,15 @@ pub const Isolate = struct {
331331
c.v8__Isolate__SetHostImportModuleDynamicallyCallback(self.handle, callback);
332332
}
333333

334+
/// [V8]
335+
/// Sets callback for the first time import.meta is called on a module
336+
pub fn setHostInitializeImportMetaObjectCallback(
337+
self: Self,
338+
callback: c.HostInitializeImportMetaObjectCallback,
339+
) void {
340+
c.v8__Isolate__SetHostInitializeImportMetaObjectCallback(self.handle, callback);
341+
}
342+
334343
/// [V8]
335344
/// Set callback to notify about promise reject with no handler, or
336345
/// revocation of such a previous notification once the handler is added.

0 commit comments

Comments
 (0)