Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var buttons = this.buttons;
var enable = (this.machine != null);
if (enable) {
rebindStepRun(buttons.step, buttons.run,
this.htmlForRunButton, this.htmlForPauseButton, this.machine);
}
buttons.all.forEach(function (b) { b.disabled = !enable; });
};
//////////////////
// TMController //
//////////////////
var ace = require('ace-builds/src-min-noconflict');
var TMSpecError = Parser.TMSpecError;
var YAMLException = Parser.YAMLException;
var UndoManager = ace.require('ace/undomanager').UndoManager;
// document viewer & editor. always associated with a document.
// FIXME: ensure that document is present
function TMController(containers, buttons, document) {
// FIXME: check for every container and button and throw if any are missing
Object.defineProperties(this, {
containers: { value: containers },
buttons: { value: buttons }
});
this.simulator = new TMSim(containers.simulator, buttons.simulator);
// Set up ace editor //
var editor = ace.edit(containers.editor);
Object.defineProperty(this, 'editor', {
value: editor,
'use strict';
var TMSimulator = require('./TMSimulator'),
parser = require('./parser'),
util = require('./util'),
ace = require('ace-builds/src-min-noconflict'),
d3 = require('d3');
var TMSpecError = parser.TMSpecError;
var YAMLException = parser.YAMLException;
var UndoManager = ace.require('ace/undomanager').UndoManager;
/**
* For editing and displaying a TMDocument.
* The controller coordinates the interactions between
* 1. simulator
* 2. code editor
* 3. storage
*
* All container and button params are required.
* @param {Object} containers
* Empty containers to use (contents will likely be replaced).
* @param {HTMLDivElement} containers.simulator
* @param {HTMLDivElement} containers.editorAlerts
* @param {HTMLDivElement} containers.editor
* @param {Object} buttons Buttons to use.
* @param {HTMLButtonElement} buttons.simulator.run