remove silly events
This commit is contained in:
parent
344c7f8c1e
commit
f570ac1479
@ -178,11 +178,6 @@ export const applyEvent = async (event, socket) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.name == "_console") {
|
|
||||||
console.log(event.payload.message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.name == "_remove_cookie") {
|
if (event.name == "_remove_cookie") {
|
||||||
cookies.remove(event.payload.key, { ...event.payload.options });
|
cookies.remove(event.payload.key, { ...event.payload.options });
|
||||||
queueEventIfSocketExists(initialEvents(), socket);
|
queueEventIfSocketExists(initialEvents(), socket);
|
||||||
@ -213,12 +208,6 @@ export const applyEvent = async (event, socket) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.name == "_set_clipboard") {
|
|
||||||
const content = event.payload.content;
|
|
||||||
navigator.clipboard.writeText(content);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.name == "_download") {
|
if (event.name == "_download") {
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.hidden = true;
|
a.hidden = true;
|
||||||
@ -233,11 +222,6 @@ export const applyEvent = async (event, socket) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.name == "_alert") {
|
|
||||||
alert(event.payload.message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.name == "_set_focus") {
|
if (event.name == "_set_focus") {
|
||||||
const ref =
|
const ref =
|
||||||
event.payload.ref in refs ? refs[event.payload.ref] : event.payload.ref;
|
event.payload.ref in refs ? refs[event.payload.ref] : event.payload.ref;
|
||||||
|
@ -706,7 +706,7 @@ def console_log(message: str | Var[str]) -> EventSpec:
|
|||||||
Returns:
|
Returns:
|
||||||
An event to log the message.
|
An event to log the message.
|
||||||
"""
|
"""
|
||||||
return server_side("_console", get_fn_signature(console_log), message=message)
|
return run_script(Var("console").to(dict).log.to(FunctionVar).call(message))
|
||||||
|
|
||||||
|
|
||||||
def noop() -> EventSpec:
|
def noop() -> EventSpec:
|
||||||
@ -738,7 +738,7 @@ def window_alert(message: str | Var[str]) -> EventSpec:
|
|||||||
Returns:
|
Returns:
|
||||||
An event to alert the message.
|
An event to alert the message.
|
||||||
"""
|
"""
|
||||||
return server_side("_alert", get_fn_signature(window_alert), message=message)
|
return run_script(Var("window").to(dict).alert.to(FunctionVar).call(message))
|
||||||
|
|
||||||
|
|
||||||
def set_focus(ref: str) -> EventSpec:
|
def set_focus(ref: str) -> EventSpec:
|
||||||
@ -881,10 +881,12 @@ def set_clipboard(content: str) -> EventSpec:
|
|||||||
Returns:
|
Returns:
|
||||||
EventSpec: An event to set some content in the clipboard.
|
EventSpec: An event to set some content in the clipboard.
|
||||||
"""
|
"""
|
||||||
return server_side(
|
return run_script(
|
||||||
"_set_clipboard",
|
Var("navigator")
|
||||||
get_fn_signature(set_clipboard),
|
.to(dict)
|
||||||
content=content,
|
.clipboard.to(dict)
|
||||||
|
.writeText.to(FunctionVar)
|
||||||
|
.call(content)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user