.: EDIT :. If you are having the same problem check your variable initialization, i forgot about new.
I keep getting TypeError: this._ensureElement is not a function and got TypeError: this._reset is not a function once earlier but I can't really recreate the exact setup for the latter.
I have my scripts in right order:
<script src="js/components/jquery.js"></script>
<script src="js/components/underscore.js"></script>
<script src="js/components/backbone.js"></script>
<script src="js/script.js"></script>
My model is registered before my collection.
It's a shopping cart app.
#namespacing
App =
  Collection : {}
  Model : {}
  View : {}
###
MODEL
###
class ModelItem extends Backbone.Model
  #default values
  defaults:
    name : 'Product Name' 
    quantity : 0
    unit : 'kg'
  #Increase or decrease the quantity
  change_quantity : (type) ->
    qty = @get 'quantity'
    @set 'quantity', if type is 'increase' then ++qty else --qty
###
COLLECTION
###
class CollectionItems extends Backbone.Collection
  model: ModelItem
###
VIEW
###
class ViewItems extends Backbone.View
window.view = ViewItems()
window.item = ModelItem()
                As of today, January 2020, CoffeeScript is completely dead on the market (though the GitHub repository is still kind of alive).
Short answer: No. CoffeeScript generates javascript, so its maximum possible speed equals to the speed of javascript.
You're missing the new operator.
window.view = new ViewItems()
window.item = new ModelItem()
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With