mirror of
https://github.com/denoland/deno.git
synced 2024-12-01 16:51:13 -05:00
chore(ext/webstorage): custom arity (#14201)
This commit is contained in:
parent
5b234ca270
commit
4fffc0af19
2 changed files with 4 additions and 14 deletions
|
@ -55,10 +55,7 @@
|
|||
context: "Argument 2",
|
||||
});
|
||||
|
||||
core.opSync("op_webstorage_set", {
|
||||
keyName: key,
|
||||
keyValue: value,
|
||||
}, this[_persistent]);
|
||||
core.opSync("op_webstorage_set", key, value, this[_persistent]);
|
||||
}
|
||||
|
||||
getItem(key) {
|
||||
|
|
|
@ -10,7 +10,6 @@ use deno_core::OpState;
|
|||
use rusqlite::params;
|
||||
use rusqlite::Connection;
|
||||
use rusqlite::OptionalExtension;
|
||||
use serde::Deserialize;
|
||||
use std::fmt;
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
@ -135,17 +134,11 @@ pub fn op_webstorage_key(
|
|||
Ok(key)
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SetArgs {
|
||||
key_name: String,
|
||||
key_value: String,
|
||||
}
|
||||
|
||||
#[op]
|
||||
pub fn op_webstorage_set(
|
||||
state: &mut OpState,
|
||||
args: SetArgs,
|
||||
key: String,
|
||||
value: String,
|
||||
persistent: bool,
|
||||
) -> Result<(), AnyError> {
|
||||
let conn = get_webstorage(state, persistent)?;
|
||||
|
@ -165,7 +158,7 @@ pub fn op_webstorage_set(
|
|||
|
||||
let mut stmt = conn
|
||||
.prepare_cached("INSERT OR REPLACE INTO data (key, value) VALUES (?, ?)")?;
|
||||
stmt.execute(params![args.key_name, args.key_value])?;
|
||||
stmt.execute(params![key, value])?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue