mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-25 00:29:14 -05:00
add v8::Module::get_module_namespace (#177)
This commit is contained in:
parent
19398816ab
commit
2d77996467
2 changed files with 10 additions and 0 deletions
|
@ -1349,6 +1349,10 @@ void v8__Module__GetModuleRequestLocation(const v8::Module& self, int i,
|
|||
*out = self.GetModuleRequestLocation(i);
|
||||
}
|
||||
|
||||
v8::Value* v8__Module__GetModuleNamespace(v8::Module* self) {
|
||||
return local_to_ptr(self->GetModuleNamespace());
|
||||
}
|
||||
|
||||
int v8__Module__GetIdentityHash(const v8::Module& self) {
|
||||
return self.GetIdentityHash();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ extern "C" {
|
|||
i: usize,
|
||||
out: &mut MaybeUninit<Location>,
|
||||
) -> Location;
|
||||
fn v8__Module__GetModuleNamespace(this: *mut Module) -> *mut Value;
|
||||
fn v8__Module__GetIdentityHash(this: *const Module) -> int;
|
||||
fn v8__Module__InstantiateModule(
|
||||
this: *mut Module,
|
||||
|
@ -113,6 +114,11 @@ impl Module {
|
|||
unsafe { v8__Module__GetIdentityHash(self) }
|
||||
}
|
||||
|
||||
/// Returns the identity hash for this object.
|
||||
pub fn get_module_namespace(&mut self) -> Local<Value> {
|
||||
unsafe { Local::from_raw(v8__Module__GetModuleNamespace(self)).unwrap() }
|
||||
}
|
||||
|
||||
/// Instantiates the module and its dependencies.
|
||||
///
|
||||
/// Returns an empty Maybe<bool> if an exception occurred during
|
||||
|
|
Loading…
Reference in a new issue