-
-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Hello good people of maid,
It would be useful if code blocks could communicate somehow.
Stdin - stdout
In the following pattern the code blocks are connected through the stdin-stdout:
## build
Builds important stuff
Snippet 1
```js
process.stdout.write("hi there from snippet 1");
```
Snippet 2
```js
process.stdin.on('data', console.log); // hi there from snippet 1
```
Next
Another way of allowing communication between code blocks is by injecting a method inside each code block in a similar way of how express.js
does it with their middlwares.
## build
Builds important stuff
Code block 1
```js
next('hi there from snippet 1');
```
Code block 2
```js
console.log(maid.result); // hi there from snippet 1
```
This pattern can also be used to control the execution flow:
## build
Builds important stuff
Code block 1
```js
next('hi there from snippet 1');
```
Code block 2
```js
if (true) {
console.log(maid.result); // hi there from snippet 1
}else {
next("hi there from snippet 2");
}
```
Code block 3
```bash
// This will never get executed
```
zephraph and Enteleform
Metadata
Metadata
Assignees
Labels
No labels