1 | var ipc = require('node-ipc'),
|
2 | serverName = 'webpack',
|
3 | watchDoneHandler = require('./watchDoneHandler');
|
4 |
|
5 | module.exports = {
|
6 |
|
7 | |
8 |
|
9 |
|
10 |
|
11 |
|
12 | startWatchIPCServer: function startWatchIPCServer(callback, configIndices) {
|
13 | ipc.config.id = serverName;
|
14 | ipc.config.retry = 3;
|
15 | ipc.config.silent = true;
|
16 |
|
17 | ipc.serve(
|
18 | function() {
|
19 | ipc.server.on(
|
20 | 'done',
|
21 | watchDoneHandler.bind(this, callback, ipc, configIndices)
|
22 | );
|
23 | }
|
24 | );
|
25 | ipc.server.start();
|
26 | },
|
27 |
|
28 | |
29 |
|
30 |
|
31 |
|
32 | notifyIPCWatchCompileDone: function notifyIPCWatchCompileDone(index) {
|
33 | ipc.config.id = serverName + index;
|
34 | ipc.config.stopRetrying = 3;
|
35 | ipc.config.silent = true;
|
36 |
|
37 | ipc.connectTo(
|
38 | serverName,
|
39 | function() {
|
40 | ipc.of.webpack.emit('done', index);
|
41 | }
|
42 | );
|
43 | }
|
44 | }
|