Search
ExecuteJS에서 사용할 수 있는 모든 Tauri 명령어를 확인하세요.
자바스크립트에 실행을 요청하는 명령어입니다.
import { invoke } from '@tauri-apps/api/core'; const result = await invoke('execute_js', { code: 'console.log("Hello, World!");', }); console.log(result);
매개변수:
code
반환값:
JsExecutionResult
모든 명령어는 Promise를 반환하며, 에러가 발생할 경우 적절한 에러 메시지와 함께 거부됩니다.
try { const result = await invoke('execute_js', { code: 'invalid syntax' }); } catch (error) { console.error('Execution failed:', error); }