mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 11:28:12 +08:00
Skip the web page close confirmation when crashed or in debug mode
This commit is contained in:
@@ -44,8 +44,8 @@ impl JsEditorHandle {
|
||||
// Sends a message to the dispatcher in the Editor Backend
|
||||
fn dispatch<T: Into<Message>>(&self, message: T) {
|
||||
// Process no further messages after a crash to avoid spamming the console
|
||||
let has_crashed = EDITOR_HAS_CRASHED.with(|crash_state| crash_state.borrow().clone());
|
||||
if let Some(message) = has_crashed {
|
||||
let possible_crash_message = EDITOR_HAS_CRASHED.with(|crash_state| crash_state.borrow().clone());
|
||||
if let Some(message) = possible_crash_message {
|
||||
if !self.instance_received_crashed.get() {
|
||||
self.handle_response(message);
|
||||
self.instance_received_crashed.set(true);
|
||||
@@ -82,6 +82,15 @@ impl JsEditorHandle {
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Create JS -> Rust wrapper functions below
|
||||
// ========================================================================
|
||||
|
||||
pub fn has_crashed(&self) -> JsValue {
|
||||
let has_crashed = EDITOR_HAS_CRASHED.with(|crash_state| crash_state.borrow().is_some());
|
||||
has_crashed.into()
|
||||
}
|
||||
|
||||
/// Modify the currently selected tool in the document state store
|
||||
pub fn select_tool(&self, tool: String) -> Result<(), JsValue> {
|
||||
match translate_tool_type(&tool) {
|
||||
|
||||
Reference in New Issue
Block a user