2
使用AppJS(http://appjs.org/)基本上给出了一个的NodeJS WebKit的窗口的工作。 我正在尝试利用我的代码中使用的文件和URL的拖放事件。AppJS拖放事件从来没有发射
的拖放短代码可以在这里找到:https://github.com/appjs/appjs/wiki/HTML5:-Drag-&-Drop-from-Desktop
我已经用于创建窗口的代码:
var app_window = appjs.createWindow({
width : 200,
height : 200,
showChrome : true, //display as standard os window with max/min/close buttons
alpha: false,
autoResize: true, //adjust window size automatically according to content.
resizable: true, //allow user resize of window
margin: 0,
disableSecurity:true, //turn off security restrictions.
showResizeGrip:false, //show/hide the resize grip.
name:'Drag and Drop', //undocumented parameter
opacity:1,
fullscreen:false,
topmost:true
});
事件处理代码:
var window_drop = function(event) { // this code never fires.
event.preventDefault();
console.log('drop event');
};
,我已经为触发该事件的代码:
app_window.on('ready', function() {
app_window.require = require;
app_window.process = process;
app_window.module = module;
app_window.console = console;
app_window.frame.show();
app_window.frame.center();
app_window.addEventListener("drop", window_drop);
});
规格:我在Mac OSX Lion上运行NodeJS 32位(AppJS要求)。
我知道AppJS是在它的起步阶段,但是这应该工作。
可能是什么问题呢?为什么事件从未解雇?
你有什么@客户端?也许你阻止它。 – 2013-04-22 12:18:08
没有“客户端”,因为这不是传统的服务器。唯一的“客户端”我想你可能会被提到的index.html页面是AppJS加载到WebKit的,这是空白的,除了一个
是在大多数情况下,有一个客户端,服务器'app.js'和文件夹'content'。你有客户端和服务器端的JavaScript。但阅读该评论意味着你的客户端没有JavaScript。 – 2013-04-22 12:26:06