-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
91 lines (75 loc) · 1.88 KB
/
index.js
File metadata and controls
91 lines (75 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
"use strict";
var app = module.exports = require('appjs'),
Server = require('./lib/server'),
Client = require('./lib/client'),
server, client,
when = require('when');
app.serveFilesFrom(__dirname + '/lib/appjs/content');
var menubar = app.createMenu([{
label:'&File',
submenu:[{
label:'&Exit',
action: function(){
window.close();
}
}]},
{
label:'&Tools',
submenu:[{
label:'&Developer Tools',
action:function(item) {
window.frame.openDevTools();
}
}]
}]);
var window = app.createWindow({
width : 800,
height : 600,
icons : __dirname + '/lib/appjs/content/icons'
});
window.on('create', function(){
console.log('create');
});
window.on('close', function(){
if (server !== undefined){
server.stop();
}
if (client !== undefined){
console.log('disconnecting...');
client.disconnect().then(function(){
return;
});
}
});
window.on('ready', function(){
// appjs init stuff
var $ = window.$;
window.frame.show();
window.frame.center();
window.frame.setMenuBar(menubar);
window.process = process;
window.module = module;
function Escape(e){
return e.keyCode === 27;
}
window.addEventListener('keydown', function(e){
if (new Escape(e)) {
window.frame.destroy();
}
});
// real stuff
$('#messages').text('hello');
// $('#list').click(function(){
// $('#midiDeviceList').text(JSON.stringify(live.listPorts()));
// });
$('#startServer').click(function(){
$('#messages').text('starting server');
server = Server.create($);
server.begin();
});
$('#startClient').click(function(){
$('#messages').text('starting client');
client = Client.create($);
client.begin();
});
});