-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
47 lines (35 loc) · 961 Bytes
/
index.js
File metadata and controls
47 lines (35 loc) · 961 Bytes
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
var Live = require("devtools-live");
var live = new Live();
function LiveServer() {
}
LiveServer.prototype.connect = function(options) {
live.connect(options);
};
LiveServer.prototype.devtools = function(options) {
return live.devtools(options);
};
LiveServer.prototype.watch = function(options) {
live.watch(options);
};
LiveServer.prototype.start = function(options) {
live.start(options);
};
LiveServer.prototype.open = function(url, name) {
live.open(url, name);
};
LiveServer.prototype.reload = function() {
if (live.ws !== undefined) {
live.ws.broadcast({action:'reload'});
}
};
LiveServer.prototype.edit = function() {
var files = Array.prototype.slice.call(arguments);
if (files[files.length - 1] === 'function') done = files.pop();
done = typeof done === 'function' ? done : function() {};
files.forEach(function(file) {
live.onFileChange(file.path);
done();
});
};
var server = new LiveServer();
module.exports = server;