main: allow passing extra options to --custom-module and make them available through global object "options"
This commit is contained in:
parent
e4f05b1ae5
commit
8441a4983e
5 changed files with 9 additions and 5 deletions
|
|
@ -17,11 +17,12 @@ class OscServer {
|
|||
this.customModuleEventEmitter = new EventEmitter()
|
||||
this.customModule = (()=>{
|
||||
|
||||
if (!settings.read('customModule')) return false
|
||||
var customModule = settings.read('customModule')
|
||||
if (!customModule) return false
|
||||
|
||||
var file = (()=>{
|
||||
try {
|
||||
return fs.readFileSync(settings.read('customModule'),'utf8')
|
||||
return fs.readFileSync(customModule[0], 'utf8')
|
||||
} catch(err) {
|
||||
console.log('CustomModule Error: File not found: ' + settings.read('customModule'))
|
||||
return false
|
||||
|
|
@ -37,7 +38,8 @@ class OscServer {
|
|||
clearTimeout,
|
||||
setInterval,
|
||||
clearInterval,
|
||||
settings
|
||||
settings,
|
||||
options: customModule.slice(1, customModule.length)
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ var options = {
|
|||
'l':{alias:'load',type:'string',file:{name:'OSC Session (.json)', extensions: ['json', 'js']},describe:'session file to load'},
|
||||
'state':{type:'string',file:{name:'OSC State (.state)', extensions: ['state']},describe:'state file to load'},
|
||||
'b':{alias:'blank',type:'boolean',describe:'load a blank session and start the editor'},
|
||||
'c':{alias:'custom-module',type:'string',file:{name:'OSC Custom module (.js)', extensions: ['js']},describe:'custom module file to load'},
|
||||
'c':{alias:'custom-module',type:'array',file:{name:'OSC Custom module (.js)', extensions: ['js']},describe:'custom module file to load (custom options can be passed after the filename)'},
|
||||
'p':{alias:'port',type:'number',describe:'http port of the server (default to 8080)',
|
||||
check: (p)=>{
|
||||
return (!isNaN(p) && p > 1023 && parseInt(p)===p) ?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue