12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <!DOCTYPE html>
- <html>
- <body>
- <div>
- <button id="log">Call Log API</button>
- <button id="request">Call Request (async) API</button>
- <button id="event">Send event to Rust</button>
- </div>
- <div style="margin-top: 24px">
- <select id="dir">
- <option value="">None</option>
- </select>
- <input id="path-to-read" placeholder="Type the path to read...">
- <button id="read">Read</button>
- </div>
- <div style="margin-top: 24px">
- <input id="url" value="https://tauri.studio">
- <button id="open-url">Open URL</button>
- </div>
- <div style="margin-top: 24px">
- <input id="title" value="Awesome Tauri Example!">
- <button id="set-title">Set title</button>
- </div>
- <div style="margin-top: 24px">
- <input id="dialog-default-path" placeholder="Default path">
- <input id="dialog-filter" placeholder="Extensions filter">
- <div>
- <input type="checkbox" id="dialog-multiple">
- <label>Multiple</label>
- </div>
- <div>
- <input type="checkbox" id="dialog-directory">
- <label>Directory</label>
- </div>
- <button id="open-dialog">Open dialog</button>
- <button id="save-dialog">Open save dialog</button>
- </div>
- <div id="response"></div>
- <script>
- function registerResponse (response) {
- document.getElementById('response').innerHTML = typeof response === 'object'
- ? JSON.stringify(response)
- : response
- }
- function addClickEnterHandler (button, input, handler) {
- button.addEventListener('click', handler)
- input.addEventListener('keyup', function (e) {
- if (e.keyCode === 13) {
- handler()
- }
- })
- }
- window.onTauriInit = function () {
- window.tauri.listen('rust-event', function (res) {
- document.getElementById('response').innerHTML = JSON.stringify(res)
- })
- var dirSelect = document.getElementById('dir')
- for (var key in window.tauri.Dir) {
- var value = window.tauri.Dir[key]
- var opt = document.createElement("option")
- opt.value = value
- opt.innerHTML = key
- dirSelect.appendChild(opt)
- }
- }
- </script>
- <script src="communication.js"></script>
- <script src="fs.js"></script>
- <script src="window.js"></script>
- <script src="dialog.js"></script>
- </body>
- </html>
|