Javascript library for working with WebPipes. Use with Node.js or in the browser.
Just include the script. The webpipe
object is automagically added to your
environment. No need for new
or any other sort of initialization.
Automatically include the most recent release:
<script src="https://unpkg.com/webpipe/umd/webpipe.min.js"></script>
Or, use a specific version by replacing x.x.x
:
<script src="https://unpkg.com/[email protected]/umd/webpipe.min.js"></script>
Or, if you're using webpipe.js with node.js
$ npm i webpipe --save
Then require the "webpipe" module:
const webpipe = require('webpipe')
webpipe.js exposes two methods: webpipe.execute()
and webpipe.options()
. Use
webpipe.options()
to load a WebPipe's Block Definition. It can be handy while
debugging and/or learning about new WebPipes. See
examples/ for
usage examples.
The real workhorse is webpipe.execute()
. Use it to make a request to your
WebPipe of choice.
const url = 'https://webpip.es/calculate-square-root'
const inputs = { radicand: 9 }
webpipe.execute(url, inputs, (err, outputs) => {
if (err) {
throw new Error(err.message)
}
console.log(outputs)
})
All comments in how to improve this library are very welcome. Feel free post suggestions to the Issue tracker, or even better, fork the repository to implement your own ideas and submit a pull request.
Unless attributed otherwise, everything is under the MIT License (see LICENSE for more info).