Skip to content

Used by Publications. Just backbone models.

Notifications You must be signed in to change notification settings

nice-digital/backbone-model

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

backbone-model

Backbone models as a discrete component, with sync stripped out.

This has been run against the official Backbone test suite and passes all tests.

Installation

Install with npm(1):

$ npm install --save backbone-model

Install with component(1):

$ component install green-mesa/backbone-model

API

Normal usage

  var Model = require('backbone-model').Model;

  var MyModel = Model.extend({ someShizzle : "Hello world"});

  var myInstanceOfMyModel = new MyModel();

Adding Backbone Sync functionality.

You need to $ component install green-mesa/backbone-sync (which, by the way, will also install jQuery. Fun times. A non-jQuery replacement would be good at this point)

	var Model = require('backbone-model').Model;
	var sync = require('backbone-sync').sync;
	
	Model.prototype.sync = function(){

		return sync.apply(this, arguments);

	};

Some commonJS related quirks mean that overridding the ajax handler is a bit pointless as you've already got jQuery installed by default. Write a replacement backbone-sync module and use that instead. That's the component way.

License

MIT

About

Used by Publications. Just backbone models.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.8%
  • Makefile 1.2%