Created
July 24, 2013 19:10
-
-
Save psykidellic/6073525 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _ = require('underscore') | |
| Backbone = require('backbone') | |
| data = | |
| id: 1 | |
| queue_items: [ | |
| id: 1 | |
| song: | |
| id: 1 | |
| name: 'song 1' | |
| , | |
| id: 2 | |
| name: 'song 2' | |
| , | |
| id: 2 | |
| song: | |
| id: 3 | |
| name: 'song 3' | |
| , | |
| id: 4 | |
| name: 'song 4' | |
| ] | |
| class Song extends Backbone.Model | |
| class QueueItem extends Backbone.Model | |
| initialize: -> | |
| console.log("queueitem called") | |
| @song = new Song(@get('song')) | |
| class QueueItems extends Backbone.Collection | |
| model: QueueItem | |
| class Queue extends Backbone.Model | |
| initialize: -> | |
| console.log("initialize called") | |
| @items = new QueueItems(@get('queue_items')) | |
| queue = new Queue(data) | |
| # console.log(queue.get('queue_items')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Might do:
So you can swap them out later if you change your mind.