Backbone extensions - llorsat/wonkajs GitHub Wiki

Additional functions for backbone Views, Models and Collections.

This new functions on backbone objects, include a new attribute, the params object, that exists inside the Model and Collection.

Model

addParam

Add just one attribute to the model params attribute.

addParams

Add many attributes to the model params attribute.

getParams

Return all attributes on the model params attribute.

removeParam

Remove any param choosed from the model params attribute.

clearParams

Remove all params from the model params attribute.

getParam

Return any param choosed from the model params attribute.

getParamsQuery

Serialize the model params attribute. It means, convert an object to a querystring for http get requests.

getOrElse

Return any attribute value with the name passed or the default value passed.

toJSON

Convert all the children attributes models or collections to json objects.

Collection

addParam

Add just one attribute to the collection params attribute.

addParams

Add many attributes to the collection params attribute.

getParams

Return all attributes on the collection params attribute.

removeParam

Remove any param choosed from the collection params attribute.

clearParams

Remove all params from the collection params attribute.

getParam

Return any param choosed from the collection params attribute.

getParamsQuery

Serialize the collection params attribute. It means, convert an object to a querystring for http get requests.

View

remove

Enhance the backbone View.remove with undelegate events.