python-style class variables in javascript -



python-style class variables in javascript -

it can hard find these kinds of questions since can phrased many different ways, please forgive me if duplicate. i'd define class variables on backbone model in such way still available on instances. done so:

var foo_base = { foo: bar }, foomodel = backbone.model.extend(foo_base, foo_base);

but quite ugly involves feeding same object both instance , class prototype. there simpler way involves 1 utilize of foo_base or foo?

http://backbonejs.org/#model-extend

backbone.model.extend(properties, [classproperties])

i unable understand why want send same object instance properties & classproperties.

to create model without instance properties classproperties, can like

var foo_base = { foo: bar }, foomodel = backbone.model.extend({}, foo_base);

javascript class backbone.js

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -