mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-07 23:20:06 +08:00

* Cleanup bundled runtime entry point * Fix JS representation of Screen struct * Expose IsFocused method in Window interface * Update JS window API * Fix cleanup of WML listeners * Bundle runtime as ES module * Update runtime dependencies * Update runtime types and events * Update bundled runtime * Update changelog --------- Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
39 lines
1.2 KiB
HTML
39 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Title</title>
|
|
<style>body{ text-align: center; color: white; background-color: #191919; user-select: none; -ms-user-select: none; -webkit-user-select: none; }</style>
|
|
</head>
|
|
<body>
|
|
<h1>Drag-n-drop Demo</h1>
|
|
<br/>
|
|
Drop Files onto this window...
|
|
<div id="results"></div>
|
|
</body>
|
|
|
|
<script type="module">
|
|
import * as wails from "/wails/runtime.js";
|
|
|
|
document.body.addEventListener('drop', function(e) {
|
|
// Note that postMessageWithAdditionalObjects does not accept a single object,
|
|
// but only accepts an ArrayLike object.
|
|
// However, input.files is type FileList, which is already an ArrayLike object so
|
|
// no conversion to array is needed.
|
|
const currentFiles = input.files;
|
|
chrome.webview.postMessageWithAdditionalObjects("FilesDropped", currentFiles);
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
return false;
|
|
});
|
|
wails.Events.On("files", function(event) {
|
|
let resultsHTML = "";
|
|
event.data.forEach(function(file) {
|
|
resultsHTML += "<br/>" + file;
|
|
});
|
|
document.getElementById("results").innerHTML = resultsHTML;
|
|
})
|
|
</script>
|
|
|
|
</html>
|