Add a placeholder for JavaScript fetch() function
This commit is contained in:
parent
d6de09bd0a
commit
890f2f527f
3 changed files with 13 additions and 0 deletions
10
lib/src/fnc/script/globals/fetch.rs
Normal file
10
lib/src/fnc/script/globals/fetch.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use crate::sql::value::Value;
|
||||
use js::Rest;
|
||||
use js::Result;
|
||||
|
||||
#[js::bind(object, public)]
|
||||
#[quickjs(rename = "fetch")]
|
||||
#[allow(unused_variables)]
|
||||
pub fn fetch(args: Rest<Value>) -> Result<Value> {
|
||||
Ok(Value::None)
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
pub mod surrealdb;
|
||||
pub mod fetch;
|
||||
|
|
|
@ -39,6 +39,8 @@ pub async fn run(
|
|||
let global = ctx.globals();
|
||||
// Register the surrealdb module as a global object
|
||||
global.init_def::<globals::surrealdb::Package>().unwrap();
|
||||
// Register the fetch function as a global object
|
||||
global.init_def::<globals::fetch::Fetch>()?;
|
||||
// Register the Duration type as a global class
|
||||
global.init_def::<classes::Duration>().unwrap();
|
||||
// Register the Record type as a global class
|
||||
|
|
Loading…
Reference in a new issue