jBatch Rapidest web development*)
jBatch is a JavaScript library to run batch scripts in browsers. Batch scripts consist of commands which are executed one after another. As commands are implemented with JavaScript, they can do about anything. Whether it’s running animations, accessing web services or displaying charts — everything is just one command away. jBatch is the one unified interface for everything what’s possible on the web today.
Get started
1. Link jBatch
<script src="//jbatch.iomash.com/1/jbatch.min.js" async></script>
2. Add script
<script type="text/jbatch">
</script>
3. Invoke commands
Command | Example | Description |
---|---|---|
after | echo <h2>Hello, world!</h2> | after h1 | Insert data after an element |
ajax | ajax --type GET http://api.openweathermap.org/data/2.5/weather?q=Los+Angeles | Send an Ajax HTTP request |
appendTo | echo <small>Hello, world!</small> | appendTo h1 | Append data to an element |
audio | audio http://example.com/myAudioFile.mp3 | Create an audio element |
autoplay | audio http://example.com/myAudioFile.mp3 | autoplay | Set autoplay property |
before | echo <h1>Hello, world!</h1> | before h2 | Insert data before an element |
bootstrap | bootstrap | Use Bootstrap layout |
bounce | bounce in h1 | Bounce an element |
controls | audio http://example.com/myAudioFile.mp3 | controls | Set controls property |
coverBackground | video http://example.com/myVideoFile.webm | coverBackground | Stretch out an element in the background |
disqus | disqus --appendTo body MyWebsite | Embed a Disqus forum |
echo | echo Hello, world! | log | Write arguments to context output |
every | every 1000 { echo Another second passed | log } | Execute commands periodically |
exec | exec echo Hello, world! | Execute commands from a string |
fade | fade in h1 | Fade an element |
flip | flip in-x h1 | Flip an element |
fx | fx --from USD --to EUR 100 | appendTo body | Convert currencies |
ga | ga create UA-12345678-9; ga send pageview | Measure with Google Analytics |
get | get http://api.openweathermap.org/data/2.5/weather?q=Los+Angeles | Send an Ajax HTTP GET request |
golem | Query Golem.de | |
highchart | Create charts | |
highlight | highlight pre>code | Highlight source code |
jscall | jscall MyJavaScriptFunction | Call a JavaScript function |
jsonMask | omdb Whiplash | jsonMask Plot | log | Run an XPath-like query against a JSON object |
jsonPath | Run a JSONPath query against a JSON object | |
jsonToString | omdb Whiplash | jsonToString | appendTo body | Stringify a JSON object |
jsonp | Make a JSONP call | |
lightspeed | lightspeed in-right h1 | Animate an element with lightspeed |
log | echo Hello, world! | log | Send data to the browser's console window |
loop | Set loop property | |
matchRegex | Match a string against a regular expression | |
omdb | omdb terminator | Query Open Movie Database |
onclick | onclick button { echo Click! | log } | Execute commands when a mouse button is clicked |
onsubmit | Execute commands when a form is submitted | |
parseHTML | Parse HTML | |
parseJSON | Parse JSON | |
parseXML | parseXML <foo><bar>quo</bar></foo> | log | Parse XML |
post | Send an Ajax HTTP POST request | |
preload | preload echo | Preload a command |
prependTo | echo Hello, world! | prependTo h1 | Prepend data to an element |
random | Generate a random number | |
roll | roll in h1 | Roll an element |
rotate | rotate in h1 | Rotate an element |
run | Execute a batch file | |
sleep | sleep 1000; echo Slept a second! | log | Halt execution for some time |
twitter follow --appendTo body iomash | Create a Twitter button | |
video | video http://example.com/myVideoFile.webm | Create a video element |
wandbox | wandbox --compiler python-2.7.3 --code "print('Hello!')" | Compile and run code online |
webcam | webcam | appendTo body | Create a webcam element |
wikipedia | wikipedia JavaScript | log | Query Wikipedia |
xmlToString | xmlDoc | xmlToString | appendTo body | Stringify an XML document |
xpath | getDocument | xpath //title | log | Run an XPath query against an XML document |
youtube | youtube 'david guetta' | log | Query Youtube |
zoom | zoom out --direction down h1 | Zoom an element |
Get help
Documentation
For more details about how jBatch works, check GitHub.
Questions
Post your questions on Stack Overflow and tag them with “jbatch”.
Examples
There is a growing list of examples tagged with “jbatch” at CodePen.
Support
Commercial support is available for early adopters. Please contact us at jbatch@iomash.com.
Get involved
Bugs
Please report bugs on GitHub.
Join
We need more commands, and we need more powerful commands! Head over to GitHub and send us your pull requests.
Get answers
What is jBatch good for?
jBatch greatly simplifies access to tons of “things” web developers need access to. Things (let’s call them resources from now on) can be quite different — web services, animations, charts… anything which is beyond plain simple HTML. Usually it depends on each and every resource how it is accessed. And that means again and again spending time learning how to access resources and copying/pasting implementation details around like JavaScript code, CSS stylesheets, fonts and whatever else is required.
jBatch introduces one interface to get access to everything — any resource on the internet. With jBatch everything becomes a command. Stop spending time learning how to access resources exactly and worrying about implementation details — just run commands.
Think of jBatch being the command line interface for the web. If you are familiar with shells, then you are very much accustomed to running commands. You want to get stuff done and don’t care how commands are implemented and work. jBatch brings this user experience to the web. This doesn’t mean that a programming language like JavaScript goes away — shells and command line utilities didn’t make programming languages disappear either. But they make access to lots of things easier for tons of users.
Is jBatch a programming language?
JavaScript is the programming language of the web, and jBatch does not intend to compete with or replace JavaScript. For example, jBatch does not support any control flow statements like if
or while
.
Think of jBatch as a layer on top of JavaScript. While JavaScript is the programming language for the web, jBatch is the batch language for the web. jBatch runs commands which are implemented with JavaScript and can use other resources like CSS or fonts. But on the layer above where jBatch lives these things don’t matter. jBatch users run commands which let them more easily express what they want.