Skip to content

Commit d11f363

Browse files
committed
download copy handler
1 parent 0590f6d commit d11f363

22 files changed

+4092
-2744
lines changed

Assets/UXF/Examples/1_Basic/BasicExample.unity

Lines changed: 2452 additions & 2317 deletions
Large diffs are not rendered by default.

Assets/UXF/Plugins/WebFunctions.jslib

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
mergeInto(LibraryManager.library, {
2+
3+
Download: function(text, filename) {
4+
text = Pointer_stringify(text);
5+
filename = Pointer_stringify(filename);
6+
7+
var element = document.createElement('a');
8+
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
9+
element.setAttribute('download', filename);
10+
11+
element.style.display = 'none';
12+
document.body.appendChild(element);
13+
14+
element.click();
15+
},
16+
17+
CopyToClipboard: function(text) {
18+
text = Pointer_stringify(text);
19+
var elem = document.createElement("textarea");
20+
document.body.appendChild(elem);
21+
elem.value = text;
22+
elem.select();
23+
document.execCommand("copy");
24+
document.body.removeChild(elem);
25+
}
26+
27+
});

Assets/UXF/Plugins/WebFunctions.jslib.meta

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

0 commit comments

Comments
 (0)