appjs

Using node.js os.cpus() to detect user idle time?

我是研究僧i 提交于 2020-01-04 10:38:55
问题 I'm developing a chat application with appjs that uses node.js as the platform. I'm stucked with detecting when computer is idle (when user is away from it or not using it). There is os module in node.js and its os.cpus() provides such information for each core: [ { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', speed: 2926, times: { user: 252020, nice: 0, sys: 30340, idle: 1070356870, irq: 0 } }, { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', speed: 2926, times: { user: 306960, nice: 0

fs.writeFile() doesn't return callback

青春壹個敷衍的年華 提交于 2019-12-22 04:53:08
问题 I'm trying to write a file with the users authentication data to the disk. To achieve this I wrote the following function: function writeAuthFile(data, success, fail) { var fs = require('fs'); fs.writeFile('auth.json', JSON.stringify(data), function(error) { if(error) { console.log('[write auth]: ' + err); if (fail) fail(error); } else { console.log('[write auth]: success'); if (success) success(); } }); } But it never calls the callback. I looked at the nodeJS docs for fs and it all seems to

appjs - compile into single executable?

ⅰ亾dé卋堺 提交于 2019-12-20 10:25:24
问题 I've spent all night trying different tools for building cross platform desktop apps via html5 and so far appjs seems to be perfect. I've only been playing around with the windows executable-based demo project but I'm wondering if there is any guide or tutorial on how to convert the project to cross platform executables (single files) instead of the appjs loader executable with all the sources in a subfolder. I've also tried adobe air however css animations is beyond poor, slow/choppy (might

“window.frame.openDialog” not able select files in Mac OS X

送分小仙女□ 提交于 2019-12-12 09:18:33
问题 Using window.frame.openDialog , I am not able to select the files from the Open dialog box in Mac OS X . I could select the directory but not the files. Is there any way to select the files? My code is: window.frame.openDialog({ type: 'open', title: 'Open...', multiSelect: false, acceptTypes: { 'Images': ['*.hwc'] }, dirSelect: false, initialValue: '/' }); 回答1: In MAC it is not possible to select files using window.frame.openDialog , instead of you can search and select file using fs.readFile

How to enable harmony in Coffeescript?

好久不见. 提交于 2019-12-07 02:29:00
问题 Here is how I run my js code: node --harmony ./data/app.js Now I want to move to the CoffeeScript. So I try to run it like that: coffee ./data/app.coffee And it fails. How can I pass this --harmony option? 回答1: To pass args through, you can use the --nodejs argument: coffee --nodejs --harmony ./data/app.coffee 来源: https://stackoverflow.com/questions/13548196/how-to-enable-harmony-in-coffeescript

fs.writeFile() doesn't return callback

江枫思渺然 提交于 2019-12-05 05:41:45
I'm trying to write a file with the users authentication data to the disk. To achieve this I wrote the following function: function writeAuthFile(data, success, fail) { var fs = require('fs'); fs.writeFile('auth.json', JSON.stringify(data), function(error) { if(error) { console.log('[write auth]: ' + err); if (fail) fail(error); } else { console.log('[write auth]: success'); if (success) success(); } }); } But it never calls the callback. I looked at the nodeJS docs for fs and it all seems to check out. Also all other asynchronous execution seems to have halted. This is the first time I'm

“window.frame.openDialog” not able select files in Mac OS X

天涯浪子 提交于 2019-12-04 20:05:16
Using window.frame.openDialog , I am not able to select the files from the Open dialog box in Mac OS X . I could select the directory but not the files. Is there any way to select the files? My code is: window.frame.openDialog({ type: 'open', title: 'Open...', multiSelect: false, acceptTypes: { 'Images': ['*.hwc'] }, dirSelect: false, initialValue: '/' }); In MAC it is not possible to select files using window.frame.openDialog , instead of you can search and select file using fs.readFile . 来源: https://stackoverflow.com/questions/15288695/window-frame-opendialog-not-able-select-files-in-mac-os

appjs - compile into single executable?

≯℡__Kan透↙ 提交于 2019-12-02 21:14:04
I've spent all night trying different tools for building cross platform desktop apps via html5 and so far appjs seems to be perfect. I've only been playing around with the windows executable-based demo project but I'm wondering if there is any guide or tutorial on how to convert the project to cross platform executables (single files) instead of the appjs loader executable with all the sources in a subfolder. I've also tried adobe air however css animations is beyond poor, slow/choppy (might be doing something wrong not sure). A year or so ago I was tinkering with titanium however they've

Using iframe with local files in Chrome

ぃ、小莉子 提交于 2019-11-26 17:42:41
I am having a tough time figuring out how to access a page loaded in an iframe from the outer page. Both pages are local files, and I'm using Chrome. I have an outer page, and many inner pages. The outer page should always display the page title for the inner page (it makes sense in my application, perhaps less so in this stripped-down example). This works without any problem in AppJS, but I've been requested to make this app work directly in the browser. I'm getting the error " Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must

Using iframe with local files in Chrome

狂风中的少年 提交于 2019-11-26 05:33:47
问题 I am having a tough time figuring out how to access a page loaded in an iframe from the outer page. Both pages are local files, and I\'m using Chrome. I have an outer page, and many inner pages. The outer page should always display the page title for the inner page (it makes sense in my application, perhaps less so in this stripped-down example). This works without any problem in AppJS, but I\'ve been requested to make this app work directly in the browser. I\'m getting the error \" Blocked a