[oden] Hot-reload script files
This commit is contained in:
parent
642ced45f8
commit
a850c3cc58
7 changed files with 241 additions and 9 deletions
|
|
@ -396,6 +396,23 @@ impl ContextRef {
|
|||
pub fn process_all_jobs(&self) -> Result<()> {
|
||||
self.get_runtime().process_all_jobs()
|
||||
}
|
||||
|
||||
/// Deserialize a value from bytes generated by `ValueRef::serialize()`.
|
||||
///
|
||||
/// NOTE: The serialized value is only good for this exact version of
|
||||
/// QuickJS- do *not* expect to be able to save it to disk and
|
||||
/// re-load it. This is for more ephemeral usage: passing values
|
||||
/// between threads, etc.
|
||||
pub fn deserialize(&self, data: &[u8]) -> Result<Value> {
|
||||
self.check_exception(unsafe {
|
||||
sys::JS_ReadObject(
|
||||
self.ctx,
|
||||
data.as_ptr(),
|
||||
data.len(),
|
||||
sys::JS_READ_OBJ_REFERENCE as i32,
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue