Skip to content

基于tauri实现的工具集合应用,支持插件安装

Notifications You must be signed in to change notification settings

feint123/dtools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dtools

基于tauri实现的工具集合应用,支持插件安装


⚠️ 最新代码请切换至 dev 分支

如果加载的插件中使用到了tauri的api,在编译项目前请先修改tauri的部分源码

目录:tauri-1.2.3>src>api>ipc.rs>format_callback

原来的代码

pub fn format_callback<T: Serialize>(
  function_name: CallbackFn,
  arg: &T,
) -> crate::api::Result<String> {
  serialize_js_with(arg, Default::default(), |arg| {
    format!(
      r#"
    if (window["_{fn}"]) {{
      window["_{fn}"]({arg})
    }} else {{
      console.warn("[TAURI] Couldn't find callback id {fn} in window. This happens when the app is reloaded while Rust is running an asynchronous operation.")
    }}"#,
      fn = function_name.0,
      arg = arg
    )
  })
}

修改后的代码

pub fn format_callback<T: Serialize>(
  function_name: CallbackFn,
  arg: &T,
) -> crate::api::Result<String> {
  serialize_js_with(arg, Default::default(), |arg| {
    format!(
      r#"
    if (window["_{fn}"]) {{
      window["_{fn}"]({arg})
    }} else {{
      if ( null != document.getElementById('__plugin_container__') && document.getElementById('__plugin_container__').contentWindow["_{fn}"]) {{
        document.getElementById('__plugin_container__').contentWindow["_{fn}"]({arg})
      }} else {{
        console.warn("[TAURI] Couldn't find callback id {fn} in window. This happens when the app is reloaded while Rust is running an asynchronous operation.")
      }}
    }}"#,
      fn = function_name.0,
      arg = arg
    )
  })
}

About

基于tauri实现的工具集合应用,支持插件安装

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published