Need help with kiwi?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

123 Stars 2 Forks MIT License 41 Commits 1 Opened issues


Kiwi is a framework built on top of jQuery that helps you write tidy, concise frontend JavaScript

Services available


Need anything else?

Contributors list

# 564,364
41 commits

= Kiwi

Kiwi likes HTTP. Kiwi likes REST. Kiwi doesn't like it when you have to do tedious things like writing down urls to get data from your server.

== Models map to Resources

We can define a couple of models

$m('Post', { resource: 'posts', has: {'comments':'Comment'} })

$m('Comment', {resource: 'comments'})

So now we can say, in a controller

$m.Post.find('all', this.publish)


$m.Post.find(1).comments.find('all', this.publish)

or perhaps


The http requests that get fired are, respectively: (GET) (GET) (DELETE)

== HTTP error codes rule

If our server returns a different status code for each server error (or error class), we can easily react differently in the front end:

In a view:

$v('CommentList', { listeners: { '.more click': {action: 'Comments.get', onerror: 'errors'} }, errors: { 404: function(){ alert("Sorry, not found!") }, 403: function(statuscode, message){ alert(message) } } })

We can also define a catch all error handler in case none of them are defined in our view:

$k.options.globalerrorhandler.base = function(){ alert("You got some random error!") }

== Concise and flexible parameter passing

In a controller

$m.Post.create(this.params, this.publish)

This will automatically serialize the parameters in the form of the calling view and send it over the wire. Currently this.params assumes that you have only one form per view.

If you need to set a prefix to your parameters, simply set:

this.options.param_prefix = 'post'

before calling the model.

You can also set as the parameter argument a jQuery object representing a form, or a function that returns either jQuery-ized form, an arbitrary object you want to serialize, or a string.

== Please fork if you like this

Kiwi is good for this and other things. It can be improved in many ways, and I would love some help :)

== Documentation


We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.