-
-
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.
- Loading branch information
1 parent
ce3ef52
commit 1c363f3
Showing
2 changed files
with
7 additions
and
7 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
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,25 +1,25 @@ | ||
// For Deno | ||
// import Blackprint from 'https://cdn.skypack.dev/@blackprint/[email protected]'; | ||
// import Blackprint from '../../dist/engine.mjs'; | ||
import Blackprint from '../dist/engine.mjs'; | ||
|
||
// For Node.js | ||
// import Blackprint from '@blackprint/engine'; | ||
import Blackprint from '../../dist/engine.min.js'; | ||
// import Blackprint from '../../dist/engine.min.js'; | ||
|
||
// Run from your CLI | ||
// deno run --allow-net init.mjs | ||
|
||
// For Node.js you can also run this script like below | ||
// node --no-warnings --loader ../es6-https-loader.mjs ./init.mjs | ||
// node --no-warnings --loader @blackprint/engine/es6-https-loader ./example/init.mjs | ||
// node --no-warnings --loader @blackprint/engine/es6-https-loader ./init.mjs | ||
|
||
// === Import JSON after all nodes was registered === | ||
// You can import this to Blackprint Sketch if you want to view the nodes visually | ||
!async function(){ | ||
let instance = new Blackprint.Engine(); | ||
Blackprint.allowModuleOrigin('*'); // Allow load from any URL (localhost/https only) | ||
|
||
await instance.importJSON('{"_":{"moduleJS":["https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-example.mjs"]},"Example/Math/Random":[{"i":0,"x":298,"y":73,"output":{"Out":[{"i":2,"name":"A"}]}},{"i":1,"x":298,"y":239,"output":{"Out":[{"i":2,"name":"B"}]}}],"Example/Math/Multiply":[{"i":2,"x":525,"y":155,"output":{"Result":[{"i":3,"name":"Any"}]}}],"Example/Display/Logger":[{"i":3,"id":"myLogger","x":763,"y":169}],"Example/Button/Simple":[{"i":4,"id":"myButton","x":41,"y":59,"output":{"Clicked":[{"i":2,"name":"Exec"}]}}],"Example/Input/Simple":[{"i":5,"id":"myInput","x":38,"y":281,"data":{"value":"saved input"},"output":{"Changed":[{"i":1,"name":"Re-seed"}],"Value":[{"i":3,"name":"Any"}]}}]}'); | ||
await instance.importJSON('{"instance":{"Example/Math/Random":[{"i":0,"x":298,"y":73,"output":{"Out":[{"i":2,"name":"A"}]}},{"i":1,"x":298,"y":239,"output":{"Out":[{"i":2,"name":"B"}]}}],"Example/Math/Multiply":[{"i":2,"x":525,"y":155,"output":{"Result":[{"i":3,"name":"Any"}]}}],"Example/Display/Logger":[{"i":3,"id":"myLogger","x":763,"y":169}],"Example/Button/Simple":[{"i":4,"id":"myButton","x":41,"y":59,"output":{"Clicked":[{"i":2,"name":"Exec"}]}}],"Example/Input/Simple":[{"i":5,"id":"myInput","x":38,"y":281,"data":{"value":"saved input"},"output":{"Changed":[{"i":1,"name":"Re-seed"}],"Value":[{"i":3,"name":"Any"}]}}]},"moduleJS":["https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-example.mjs"]}'); | ||
|
||
// Time to run something :) | ||
var button = instance.iface.myButton; | ||
|