updated examples
This commit is contained in:
parent
5566cfa7e1
commit
0d1ac26cb1
|
@ -30,6 +30,7 @@
|
|||
<button id="save">Save</button>
|
||||
<input type="file" id="fileElem" accept="application/json" style="display:none"/>
|
||||
<button id="load">Load</button>
|
||||
<button id="snapshot">Snapshot</button>
|
||||
<br/><br/>
|
||||
<select id="mode">
|
||||
<option value="self-self">Self / Self</option>
|
||||
|
|
|
@ -278,6 +278,21 @@ $(document).ready(function () {
|
|||
});
|
||||
});
|
||||
|
||||
$("#snapshot").on("click",function() {
|
||||
match.viewControl("takeSnapshot",{
|
||||
format: "jpeg"
|
||||
})
|
||||
.then((snapshot)=>{
|
||||
var a = document.createElement("a");
|
||||
a.href = snapshot;
|
||||
a.setAttribute("download",gameName+".jpg");
|
||||
a.click();
|
||||
})
|
||||
.catch((error)=>{
|
||||
console.warn("failed:",error);
|
||||
})
|
||||
});
|
||||
|
||||
// reading file locally
|
||||
var fileElem = $("#fileElem").on("change",function() {
|
||||
var fileReader = new FileReader();
|
||||
|
|
Loading…
Reference in a new issue