Skip to content

Commit

Permalink
updated o_O.js
Browse files Browse the repository at this point in the history
  • Loading branch information
weepy committed Feb 15, 2012
1 parent c22edf4 commit c4f0c24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions o_O.js
Expand Up @@ -437,7 +437,13 @@ o_O.uniqueId.id = 0
Simple evented klass system with observable properties
*/

function klass(type, properties, syncEvents) {
function klass(type, properties, parent) {
return klass.extend(type, properties, parent)
}

klass.extend = function(type, properties, parent) {
parent = parent || this

// allow typeless classes
if(properties == null) {
properties = type
Expand All @@ -449,10 +455,10 @@ function klass(type, properties, syncEvents) {
var child = function child(o) {
if(!(this instanceof child)) return new child(o)
o = o || {}

o_O.eventize(this)
for(var name in properties) {
var defaultValue = (name in o) ? o[name] : properties[name]
this[name] = o_O.property(defaultValue, syncEvents)
this[name] = o_O.property(defaultValue)
this.observeProperty(name)
}
this.type = type
Expand All @@ -462,19 +468,18 @@ function klass(type, properties, syncEvents) {
}

o_O.eventize(child)
o_O.inherits(child, this)
o_O.inherits(child, parent)

if(type) {
klass.classes[type] = child
child.type = type
}

child.properties = properties
child.extend = this.extend
child.extend = klass.extend
return child
}

klass.extend = klass
klass.properties = {}
klass.classes = {}
klass.genId = function() {
Expand Down
2 changes: 1 addition & 1 deletion o_O.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c4f0c24

Please sign in to comment.