(action: ActionEnum, key: string, data: string)
| 1 | import ActionEnum from "./ActionEnum" |
| 2 | |
| 3 | export default function sendToJava(action: ActionEnum, key: string, data: string) { |
| 4 | if (window.JavaBridge === undefined) { |
| 5 | throw new Error( |
| 6 | "window.JavaBridge is undefined. only available in JetBrains IDE.", |
| 7 | ) |
| 8 | } |
| 9 | |
| 10 | const text = JSON.stringify({ action, key, data }) |
| 11 | window.JavaBridge.send(text) |
| 12 | } |
| 13 | |
| 14 | export function editFile(name: string, content: string) { |
| 15 | return sendToJava(ActionEnum.edit, name, content) |
no test coverage detected