Remove NW.js

main
Isaiah Odhner 2018-08-23 20:20:13 -04:00
parent 886d14f09e
commit 6f85eb8d53
4 changed files with 501 additions and 1728 deletions

View File

@ -206,10 +206,10 @@ might be a pointer events spec interpretation issue, and it could easily be that
### Native App
* Switch from NW.js to Electron
* Use a boilerplate for autoupdating and such
* Use [Electron Forge](https://electronforge.io/)
* Enable autoupdating
* File association support
* Proper clipboard support; Electron has an API for copying images
* [Copy images to the clipboard](https://electronjs.org/docs/api/clipboard#clipboardwriteimageimage-type)
* A dialogue when closing
* Subwindows outside the main window
* A different way of handling always-saved documents

2199
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,22 +15,20 @@
"edit",
"canvas",
"app",
"nw-app",
"web-app"
"web-app",
"recreation",
"clone",
"image-editing",
"image-editor",
"bitmap"
],
"main": "index.html",
"scripts": {
"start": "nw",
"dev": "live-server",
"test": "parallelshell \"http-server -p 11822 --silent\" \"casperjs test test.js --engine=slimerjs\"",
"test-verbose": "parallelshell \"http-server -p 11822\" \"casperjs test test.js --engine=slimerjs --verbose --log-level=debug\""
},
"window": {
"icon": "images/icons/48.png",
"toolbar": false
},
"dependencies": {
"nw": "^0.27.4",
"wallpaper": "^2.6.0"
},
"repository": {

View File

@ -1076,7 +1076,7 @@ function set_as_wallpaper_centered(c){
}
// TODO: move the chrome handling into chrome-app.js using the system-specific override
// can do it for nw.js too, although that doesn't have a separate file yet (i.e. nw-app.js)
// can do it for nw.js / electron too
if(window.chrome && chrome.wallpaper){
get_array_buffer_from_canvas(c)
@ -1090,11 +1090,14 @@ function set_as_wallpaper_centered(c){
}).catch(function(error) {
show_error_message("Failed to set as desktop background: couldn't read image file.", error);
});
}else if(window.require){
}
/*else if(window.require){
// TODO: for electron, app.getPath("userData")
var gui = require("nw.gui");
var fs = require("fs");
var wallpaper = require("wallpaper");
// TODO: don't use base64
var base64 = c.toDataURL().replace(/^data:image\/png;base64,/, "");
var imgPath = require("path").join(gui.App.dataPath, "bg.png");
@ -1108,7 +1111,8 @@ function set_as_wallpaper_centered(c){
}
});
});
}else{
}*/
else{
c.toBlob(function(blob){
sanity_check_blob(blob, function(){
saveAs(blob, file_name.replace(/\.(bmp|png|gif|jpe?g|tiff|webp)$/, "") + " wallpaper.png");