Created
February 2, 2017 22:01
-
-
Save shamansir/b230daf8d40cb7b3f8c208c0fc2ed6a7 to your computer and use it in GitHub Desktop.
Use RPD from node_modules
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Core with Network</title> | |
<!-- gulp html-head ==style quartz ==io json ==renderer svg ==toolkit util ==root .. --> | |
<!-- Built with RPD v2.0.0 <http://shamansir.github.io/rpd> --> | |
<!-- RPD Renderer: svg --> | |
<link rel="stylesheet" href="./node_modules/rpd/src/render/svg.css"></style> | |
<!-- RPD Style: quartz (svg) --> | |
<link rel="stylesheet" href="./node_modules/rpd/src/style/quartz/svg.css"></style> | |
<!-- RPD Toolkit: util (svg) --> | |
<link rel="stylesheet" href="./node_modules/rpd/src/toolkit/util/svg.css"></style> | |
<!-- Kefir --> | |
<script src="./node_modules/kefir/dist/kefir.min.js"></script> | |
<!-- RPD --> | |
<script src="./node_modules/rpd/src/rpd.js"></script> | |
<!-- RPD's d3_tiny.js --> | |
<script src="./node_modules/rpd/src/d3_tiny.js"></script> | |
<!-- RPD Render Core: --> | |
<script src="./node_modules/rpd/src/render/shared.js"></script> | |
<!-- RPD Style: quartz (svg) --> | |
<script src="./node_modules/rpd/src/style/quartz/svg.js"></script> | |
<!-- RPD Renderer: svg --> | |
<script src="./node_modules/rpd/src/render/svg.js"></script> | |
<!-- RPD Toolkit: util --> | |
<script src="./node_modules/rpd/src/toolkit/util/shared.js"></script> | |
<script src="./node_modules/rpd/src/toolkit/util/toolkit.js"></script> | |
<!-- RPD Toolkit: util (svg) --> | |
<script src="./node_modules/rpd/src/toolkit/util/svg.js"></script> | |
<!-- RPD I/O: json --> | |
<script src="./node_modules/rpd/src/io/json.js"></script> | |
<!-- RPD navigation: browser --> | |
<script src="./node_modules/rpd/src/navigation/browser.js"></script> | |
</head> | |
<body> | |
<script> | |
var finalize = Rpd.export.json('Network'); | |
Rpd.navigation.enable(); | |
Rpd.renderNext('svg', document.body, { style: 'quartz', fullPage: true }); | |
var root = Rpd.addPatch('root'); | |
var genA = root.addNode('core/basic', 'Generate A'); | |
var outA = genA.addOutlet('util/number', 'A'); | |
outA.send(3); | |
var genB = root.addNode('core/basic', 'Generate B'); | |
var outB = genB.addOutlet('util/number', 'B'); | |
outB.send(1); | |
var test = root.addNode('util/sum-of-three', 'foo') | |
test.addInlet('util/number', 'D'); | |
test.addInlet('util/number', 'E'); | |
test.addOutlet('util/number', 'F'); | |
var sum = Rpd.addClosedPatch('sum'); | |
var sumOfThree1 = sum.addNode('util/sum-of-three', 'Sum1'); | |
var in1A = sumOfThree1.inlets['a']; | |
var in1B = sumOfThree1.inlets['b']; | |
var sum1 = sumOfThree1.outlets['sum']; | |
var sumOfThree2 = sum.addNode('util/sum-of-three', 'Sum2'); | |
var in2A = sumOfThree2.inlets['a']; | |
var sum2 = sumOfThree2.outlets['sum']; | |
sum1.connect(in2A); | |
sum.inputs([ in1A, in1B ]); | |
sum.outputs([ sum2, sum1 ]); | |
var p = root.addNode('core/reference', '[Sum Patch]'); | |
sum.project(p); | |
//outA.stream(Kefir.repeat(function() { return Kefir.sequentially(100, [1, 2, 3]); })); | |
//outB.stream(Kefir.repeat(function() { return Kefir.sequentially(200, [4, 5, 6]); })); | |
console.log(finalize()); | |
</script> | |
</body> | |
</html> |
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
{ | |
"name": "test-rpd-from-npm", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"rpd": "^2.1.0" | |
} | |
} |
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
console.log(require('rpd')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment