forked from publiclab/image-sequencer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reduce redundance of add and insert fixes publiclab#261
Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
- Loading branch information
Showing
4 changed files
with
28 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,5 @@ | ||
// add steps to the sequencer | ||
// TODO: reduce redundancy with InsertStep; this should be a specific usage of InsertStep at the final position | ||
function AddStep(_sequencer, image, name, o) { | ||
|
||
function addStep(image, name, o_) { | ||
if (_sequencer.modules[name]) var moduleInfo = _sequencer.modules[name][1]; | ||
else console.log('Module ' + name + ' not found.'); | ||
|
||
var o = _sequencer.copy(o_); | ||
o.number = _sequencer.options.sequencerCounter++; // gives a unique ID to each step | ||
o.name = o_.name || name || moduleInfo.name; | ||
o.description = o_.description || moduleInfo.description; | ||
o.selector = o_.selector || 'ismod-' + name; | ||
o.container = o_.container || _sequencer.options.selector; | ||
o.image = image; | ||
o.inBrowser = _sequencer.options.inBrowser; | ||
|
||
o.step = { | ||
name: o.name, | ||
description: o.description, | ||
ID: o.number, | ||
imageName: o.image, | ||
inBrowser: _sequencer.options.inBrowser, | ||
ui: _sequencer.options.ui, | ||
options: o | ||
}; | ||
var UI = _sequencer.events; | ||
|
||
// Tell UI that a step has been set up. | ||
o = o || {}; | ||
UI.onSetup(o.step); | ||
var module = _sequencer.modules[name][0](o, UI); | ||
|
||
_sequencer.images[image].steps.push(module); | ||
|
||
return true; | ||
} | ||
|
||
addStep(image, name, o); | ||
_sequencer.steps = _sequencer.images[image].steps; | ||
return require('./InsertStep')(_sequencer,image,-1,name,o); | ||
} | ||
module.exports = AddStep; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters