code optimize

This commit is contained in:
2020-01-15 15:21:17 +08:00
parent da7ae057f4
commit 3338f78d91
5 changed files with 43 additions and 38 deletions

View File

@ -1,4 +1,4 @@
import { ACTION_UPLOAD_STATE } from '../common';
import { Request, Actions } from '../common';
window.onload = function () {
document.querySelector('#link-extension-detail')
@ -21,10 +21,10 @@ window.onload = function () {
reader.readAsText(this.files[0], "UTF-8");
reader.onload = function (evt) {
var fileString = evt.target.result;
chrome.runtime.sendMessage({
action: ACTION_UPLOAD_STATE,
chrome.runtime.sendMessage(<Request>{
action: Actions.UPLOAD_STATE,
state: fileString,
name: fileName
fileName: fileName
}, r => {
if (r) console.log('State sent:', r);
});