mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-14 12:19:58 +01:00
Merge Commit
This commit is contained in:
@@ -2,6 +2,9 @@ language: node_js
|
||||
node_js:
|
||||
- '4'
|
||||
- '5'
|
||||
- '6'
|
||||
- '7'
|
||||
- '8'
|
||||
env:
|
||||
- CXX=g++-4.8
|
||||
script: npm test
|
||||
|
||||
17
README.md
17
README.md
@@ -75,11 +75,20 @@ Once all steps are added, This method is used to generate the output of all thes
|
||||
modules.
|
||||
|
||||
```js
|
||||
sequencer.run()
|
||||
sequencer.run();
|
||||
```
|
||||
|
||||
Additionally, an optional callback can be passed to this method.
|
||||
|
||||
```js
|
||||
sequencer.run(function(out){
|
||||
// this gets called back.
|
||||
// "out" is the DataURL of the final image.
|
||||
});
|
||||
```
|
||||
|
||||
return value: **`sequencer`** (To allow method chaining)
|
||||
|
||||
|
||||
### Removing a step from the sequencer
|
||||
|
||||
@@ -205,8 +214,9 @@ sequencer.run(image_name,from); //Image 'image' from 'from'
|
||||
The `run` method also accepts an optional callback just like before:
|
||||
|
||||
```js
|
||||
sequencer.run(image_name,from,function(){
|
||||
sequencer.run(image_name,from,function(out){
|
||||
// This gets called back.
|
||||
// "out" is the DataURL of final image.
|
||||
});
|
||||
```
|
||||
|
||||
@@ -220,6 +230,9 @@ sequencer.run({
|
||||
});
|
||||
```
|
||||
|
||||
return value: **`sequencer`** (To allow method chaining)
|
||||
|
||||
|
||||
### Removing Steps from an Image
|
||||
|
||||
Similarly, `removeSteps` can also accept an `image_name` parameter. Either, both,
|
||||
|
||||
22812
dist/image-sequencer.js
vendored
22812
dist/image-sequencer.js
vendored
File diff suppressed because one or more lines are too long
@@ -39,7 +39,7 @@
|
||||
"matchdep": "^0.3.0",
|
||||
"plotly.js": "~1.21.2",
|
||||
"save-pixels": "~2.3.4",
|
||||
"tape": "^3.5.0"
|
||||
"tape": ">=4.7.0"
|
||||
},
|
||||
"homepage": "https://github.com/publiclab/image-sequencer"
|
||||
}
|
||||
|
||||
@@ -115,6 +115,8 @@ ImageSequencer = function ImageSequencer(options) {
|
||||
json_q = formatInput.call(this,args,"r");
|
||||
|
||||
require('./Run')(this, json_q, callback);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
function loadImages() {
|
||||
|
||||
11
src/Run.js
11
src/Run.js
@@ -1,7 +1,14 @@
|
||||
function Run(ref, json_q, callback) {
|
||||
function drawStep(drawarray,pos) {
|
||||
if(pos==drawarray.length) if(ref.objTypeOf(callback)=='Function') callback();
|
||||
if(pos>=drawarray.length) return true;
|
||||
if(pos==drawarray.length) {
|
||||
image = drawarray[pos-1].image;
|
||||
if(ref.objTypeOf(callback)=='Function'){
|
||||
steps = ref.images[image].steps;
|
||||
out = steps[steps.length-1].output.src;
|
||||
callback(out);
|
||||
return;
|
||||
}
|
||||
}
|
||||
image = drawarray[pos].image;
|
||||
i = drawarray[pos].i;
|
||||
input = ref.images[image].steps[i-1].output;
|
||||
|
||||
@@ -103,8 +103,10 @@ test('insertSteps({image: {index: index, name: "module", o: options} }) inserts
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('run() runs the sequencer', function (t) {
|
||||
sequencer.run();
|
||||
test('run() runs the sequencer and returns output to callback', function (t) {
|
||||
sequencer.run(function(out){
|
||||
t.equal(typeof(sequencer.images.test.steps[sequencer.images.test.steps.length - 1].output), "object", "It Does!");
|
||||
t.equal(out,sequencer.images.test.steps[sequencer.images.test.steps.length - 1].output.src, "It Does!");
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user