DOM library and application suite
The browser is not node. Rondo is an attempt at fixing this problem.
Rondo is a client-side DOM library and application suite. The API is modeled
after the modules and conventions of node.js, to give a more node-like
feel to the frontend. It comes included with three core modules: a dom
dom), an api for doing network io (
io), and an application
framework and router (
The DOM module is built on top of the high speed and extensible Zest selector engine.
This has been a project and experiment of mine for some time. I felt like reinventing the wheel. This is an early release. The API is unstable. Tests still need to be polished.
var $ = require'dom'io = require'io'app = require'app';appset'engine' mustache;appset'view' '#content';appget'/:foo'reqsetCookie'hello' 'world';reqsetHeader'Content-Type' 'application/json';reqsend hello: reqparamsfooif err return reqredirect'/404';reqrender'#template1'hello: !reqqueryworld ? 'mars' : 'world'data: resbody;setTimeoutnext 2000;;;$readyif appgetPath !== '/'$'#content'render'#template2'another: 'page'and: 'more locals';setTimeoutappsetPath'/';2000;$'<a>hello</a>''@href': '/foo''@title': 'click me!'':margin-left': '-20px'':color': 'red''className': 'foo'appendTo'#content';;$live'button' 'click'var el = $evtarget;elsetContent'<b>thanks for clicking me</b>';elset':color' '#000';elanimatescale:1.5;evpreventDefault;;ioscript'/foo.js'if !err console.log'loaded';;
The app's router was intended to act like the connect/express router. It will wrap your handlers in a try/catch, and pass a caught error down the stack.
$ npm install rondo$ cd rondo$ make
I don't want to support every browser ever made. I'm currently (and reluctantly) supporting IE7. I maybe want to drop IE support in the future, once the stranglehold IE has on the web loses even more of its grip.
req.url- The URL of the request.
req.query- The query object.
req.rawQuery- The query string.
req.body- The body's object.
req.rawBody- The body's data.
req.send- Send a request using the current
io.request- Send an XHR.
io.jsonp- A JSONP request.
io.script- Dynamically insert and load a script.
app.settings- The configuration of the app.
app.set- Set or get a setting.
app.render- Render a template.
app.del- Router API.
app.setPath- Set's the current path.
app.getPath- Get the current path.
See LICENSE for more info.