Thenable controller for a compilation request.
Used to listen to events during compilation, and can be awaited to retrieve the compiled FlatZinc.
Cancel compilation.
const compile = model.compile({ options: { solver: 'gecode' }});setTimeout(() => { if (compile.isRunning()) { compile.cancel(); }}, 10000); Copy
const compile = model.compile({ options: { solver: 'gecode' }});setTimeout(() => { if (compile.isRunning()) { compile.cancel(); }}, 10000);
Return whether or not compilation is still in progress.
const compile = model.compile({ options: { solver: 'gecode' }});setInterval(() => { if (compile.isRunning()) { console.log('Still running'); }}, 1000) Copy
const compile = model.compile({ options: { solver: 'gecode' }});setInterval(() => { if (compile.isRunning()) { console.log('Still running'); }}, 1000)
Stop listening for an event.
const compile = model.compile({ solver: 'gecode', statistics: true});const onStat = e => { console.log(e.output);};// Start listeningcompile.on('statistics', onStat);setTimeout(() => { // Stop listening compile.off('statistics', onStat);}, 1000); Copy
const compile = model.compile({ solver: 'gecode', statistics: true});const onStat = e => { console.log(e.output);};// Start listeningcompile.on('statistics', onStat);setTimeout(() => { // Stop listening compile.off('statistics', onStat);}, 1000);
Listen for an event.
const compile = model.compile({ solver: 'gecode', statistics: true});solve.on('statistics', e => { console.log(e.statistics);}); Copy
const compile = model.compile({ solver: 'gecode', statistics: true});solve.on('statistics', e => { console.log(e.statistics);});
Thenable controller for a compilation request.
Used to listen to events during compilation, and can be awaited to retrieve the compiled FlatZinc.