mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-14 20:30:01 +01:00
Merge Commit
This commit is contained in:
@@ -2,6 +2,9 @@ language: node_js
|
|||||||
node_js:
|
node_js:
|
||||||
- '4'
|
- '4'
|
||||||
- '5'
|
- '5'
|
||||||
|
- '6'
|
||||||
|
- '7'
|
||||||
|
- '8'
|
||||||
env:
|
env:
|
||||||
- CXX=g++-4.8
|
- CXX=g++-4.8
|
||||||
script: npm test
|
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.
|
modules.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
sequencer.run()
|
sequencer.run();
|
||||||
```
|
```
|
||||||
|
|
||||||
Additionally, an optional callback can be passed to this method.
|
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
|
### 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:
|
The `run` method also accepts an optional callback just like before:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
sequencer.run(image_name,from,function(){
|
sequencer.run(image_name,from,function(out){
|
||||||
// This gets called back.
|
// 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
|
### Removing Steps from an Image
|
||||||
|
|
||||||
Similarly, `removeSteps` can also accept an `image_name` parameter. Either, both,
|
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",
|
"matchdep": "^0.3.0",
|
||||||
"plotly.js": "~1.21.2",
|
"plotly.js": "~1.21.2",
|
||||||
"save-pixels": "~2.3.4",
|
"save-pixels": "~2.3.4",
|
||||||
"tape": "^3.5.0"
|
"tape": ">=4.7.0"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/publiclab/image-sequencer"
|
"homepage": "https://github.com/publiclab/image-sequencer"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ ImageSequencer = function ImageSequencer(options) {
|
|||||||
json_q = formatInput.call(this,args,"r");
|
json_q = formatInput.call(this,args,"r");
|
||||||
|
|
||||||
require('./Run')(this, json_q, callback);
|
require('./Run')(this, json_q, callback);
|
||||||
|
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadImages() {
|
function loadImages() {
|
||||||
|
|||||||
11
src/Run.js
11
src/Run.js
@@ -1,7 +1,14 @@
|
|||||||
function Run(ref, json_q, callback) {
|
function Run(ref, json_q, callback) {
|
||||||
function drawStep(drawarray,pos) {
|
function drawStep(drawarray,pos) {
|
||||||
if(pos==drawarray.length) if(ref.objTypeOf(callback)=='Function') callback();
|
if(pos==drawarray.length) {
|
||||||
if(pos>=drawarray.length) return true;
|
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;
|
image = drawarray[pos].image;
|
||||||
i = drawarray[pos].i;
|
i = drawarray[pos].i;
|
||||||
input = ref.images[image].steps[i-1].output;
|
input = ref.images[image].steps[i-1].output;
|
||||||
|
|||||||
@@ -103,8 +103,10 @@ test('insertSteps({image: {index: index, name: "module", o: options} }) inserts
|
|||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('run() runs the sequencer', function (t) {
|
test('run() runs the sequencer and returns output to callback', function (t) {
|
||||||
sequencer.run();
|
sequencer.run(function(out){
|
||||||
t.equal(typeof(sequencer.images.test.steps[sequencer.images.test.steps.length - 1].output), "object", "It Does!");
|
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();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user