-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.coffee
40 lines (32 loc) · 1.09 KB
/
model.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
unless typeof exports is 'undefined'
Backbone = require 'backbone'
###
getObjectClass = (obj)->
if obj and obj and obj.toString
arr = obj.toString().match /function\s*(\w+)/
if arr and arr.length is 2
arr[1]
###
Backbone.Model.includes = ( filename ) ->
new_methods = require filename
for new_method of new_methods
this.prototype[ new_method ] = new_methods[ new_method ]
true
class BaseModel extends Backbone.Model
urlRoot: '/bases'
defaults:
name: "Patrick"
sexy: true
# unless typeof(module) is 'undefined'
# server_methods = require './basemodel-server'
# for extended_method of server_methods
# this.prototype[ extended_method ] = server_methods[ extended_method ]
# console.log extended_method
#console.log getObjectClass(BaseModel).toLowerCase()
unless typeof(module) is 'undefined'
#server_methods = require './basemodel-so'
#for server_method of server_methods
# BaseModel::[server_method] = server_methods[ server_method ]
#BaseModel.implements './basemodel-so'
BaseModel.includes './model-private'
module.exports = BaseModel