Skip to content

Commit

Permalink
update background.js and fileUpdate.js
Browse files Browse the repository at this point in the history
  • Loading branch information
colorpeach committed Apr 15, 2014
1 parent 423d5aa commit 1516b60
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 0 additions & 2 deletions chrome_code_format/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ window.nativeIO = document.getElementById("npApiPlugin");
chrome.runtime.onConnect.addListener(function(devToolsConnection) {
// assign the listener function to a variable so we can remove it later
var devToolsListener = function(message, sender, sendResponse) {

saveFile(message.path,message.content);
}
// add the listener
Expand All @@ -26,7 +25,6 @@ function saveFile(path,newContent){
reader.onloadend = function(e){
var data = Array.prototype.slice.call(new Uint8Array(reader.result), 0);
nativeIO.saveBlobToFile(path.replace(/^file:\/\//,""), data);
console.log("success");
};
reader.readAsArrayBuffer(blob);
}
3 changes: 1 addition & 2 deletions chrome_code_format/js/fileUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ angular
if(matchReg.test(content)){
newContent = content.replace(matchReg,function(n){
var list = reg1.exec(n);
devtoolsConsole(list);
return ((list[1]+context.formatMap[trim(n)]).replace(/\n/g,"\n"+list[2])+"\n")||n;
});
resource.setContent(newContent,false,function(info){
if(info.isError){
//invoke native io write the file
port.postMessage({
path:info.details[0],
content: newContent
Expand All @@ -53,6 +53,5 @@ angular
});
}
});

}
}]);

0 comments on commit 1516b60

Please sign in to comment.