[oden] JavaScript, god help me
This commit is contained in:
parent
16e6f1304c
commit
8d7dd789ed
6 changed files with 92 additions and 4 deletions
|
|
@ -328,6 +328,18 @@ impl ValueRef {
|
|||
ctx.check_exception(sys::JS_GetModuleExport(ctx.ctx, module, c_value.into_raw()))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn call(&self, ctx: &ContextRef) -> Result<Value> {
|
||||
unsafe {
|
||||
ctx.check_exception(sys::JS_Call(
|
||||
ctx.ctx,
|
||||
self.val,
|
||||
sys::JS_MakeUndefined(),
|
||||
0,
|
||||
std::ptr::null_mut(),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> fmt::Debug for ValueRef {
|
||||
|
|
@ -357,6 +369,20 @@ impl Value {
|
|||
rt: Runtime::from_raw(unsafe { sys::JS_GetRuntime(ctx.ctx) }),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn null(ctx: &ContextRef) -> Self {
|
||||
Value {
|
||||
value: ValueRef::from_raw(unsafe { sys::JS_MakeNull() }),
|
||||
rt: Runtime::from_raw(unsafe { sys::JS_GetRuntime(ctx.ctx) }),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn undefined(ctx: &ContextRef) -> Self {
|
||||
Value {
|
||||
value: ValueRef::from_raw(unsafe { sys::JS_MakeUndefined() }),
|
||||
rt: Runtime::from_raw(unsafe { sys::JS_GetRuntime(ctx.ctx) }),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for Value {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue