-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
56 lines (51 loc) · 1.76 KB
/
index.js
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
'use strict';
var REPLIE = require('./lib/index');
module.exports = REPLIE;
// const spawn = require('child_process').spawn;
// var runProcess = function () {
// };
/*
REPLIE Options
{
prompt: {String} Repl Command Line Prompt,
server: {Object} Express server instance, leave undefined and pass options.startSever to have replie create a server instance,
port: {Number} Port for express server to listen on, will default to 5000 if not specified (this is only used if you are passing options.startServer),
modules: {Array} Array of internal and external modules for replie to load into its context, see example below,
namespace: {String} Optional namespacing for web socket,
logger: {Function} Optional logger function, defaults to console.log,
onError: {Function} Error handling function,
connectionUrl: {String} Optional connection path if replie is starting server,
templatePath: {String} File path for html if replie is starting server,
connectionMessage: {String} Message for socket emitter on connection,
replConnectionCallback: {Function} Optional socket connection callback function defaults to emitting connectionMessage,
serverConnectionCallback: {Function} Optional server connection callback if replie is starting server, defaults to sendFile using templatePath
}
*/
// Example
// var repl = new REPLIE({
// prompt: 'REPLIE',
// child_process: true,
// startServer: true,
// modules: [
// {
// name: 'shelljs',
// type: 'external'
// },
// {
// name: 'async',
// type: 'external'
// },
// {
// name: 'lodash.clone',
// type: 'external'
// }
// ],
// namespace: 'test',
// room: 'test'
// });
// repl.start()
// .then(() => {
// console.log('Started');
// }, e => {
// console.log('start error', e);
// });