1.0.6 • Published 10 years ago

backbone.namedconstructor v1.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

backbone.namedconstructor

Build Status NPM version

Give your Backbone object a named constructor, so you can make sense of it in the dev tools console.

Works with AMD, CommonJS and browser globals.

Installation

$ npm install backbone.namedconstructor

Example

If you set a constructorName property, this will be used to name the constructor:

var Backbone = require('backbone');
require('backbone.namedconstructor');

var Model = Backbone.Model.extend({ constructorName: 'Foo' });
console.log(new Model().constructor.name);
// 'Foo'

So, instead of:

npm.io

You'll see:

npm.io

Tests

$ npm test

Credit

The basis for this module was this great Stack Overflow answer given by Dan Malcolm. Cheers!

License

MIT

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago