Skip to content

Instantly share code, notes, and snippets.

@nhattruongniit
Created October 12, 2022 15:24
Show Gist options
  • Select an option

  • Save nhattruongniit/4499678dd747421fe7e6a535098fbfb3 to your computer and use it in GitHub Desktop.

Select an option

Save nhattruongniit/4499678dd747421fe7e6a535098fbfb3 to your computer and use it in GitHub Desktop.
function open_file(e) {
var file = e.target.files[0];
if (!file) {
return;
}
var reader = new FileReader();
reader.onload = function(e) {
var contents = JSON.parse(e.target.result);
if (contents!=null) {
app.data = Object.assign(app.data,contents)
app.update()
}
};
reader.readAsText(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment