Browse files

- wrap the core with "(function () {})()"

  • Loading branch information...
1 parent 28528ff commit 870fc1f4c30cfbbc0b4a32e1767e9d00d5d6b094 @SamuraiJack SamuraiJack committed Aug 25, 2011
Showing with 118 additions and 118 deletions.
  1. +7 −1 components.json
  2. +111 −117 lib/Joose/Managed/PropertySet/Mutable.js
View
8 components.json
@@ -4,6 +4,9 @@ COMPONENTS = {
saveAs : 'joose-all.js',
contains : [
+ {
+ text : ';(function () {'
+ },
'Joose',
'Joose.Proto.Empty',
'Joose.Proto.Object',
@@ -48,7 +51,10 @@ COMPONENTS = {
'Joose.Meta.Role',
'Joose.Namespace.Keeper',
- 'Joose.Namespace.Manager'
+ 'Joose.Namespace.Manager',
+ {
+ text : '})();'
+ },
]
},
View
228 lib/Joose/Managed/PropertySet/Mutable.js
@@ -1,140 +1,134 @@
-;(function () {
-
- var __ID__ = 1
+var __ID__ = 1
+
+
+Joose.Managed.PropertySet.Mutable = new Joose.Proto.Class('Joose.Managed.PropertySet.Mutable', {
+ isa : Joose.Managed.PropertySet,
- Joose.Managed.PropertySet.Mutable = new Joose.Proto.Class('Joose.Managed.PropertySet.Mutable', {
-
- isa : Joose.Managed.PropertySet,
+ ID : null,
- ID : null,
-
- derivatives : null,
-
- opened : null,
-
- composedFrom : null,
-
-
- initialize : function (props) {
- Joose.Managed.PropertySet.Mutable.superClass.initialize.call(this, props)
-
- //initially opened
- this.opened = 1
- this.derivatives = {}
- this.ID = __ID__++
- this.composedFrom = []
- },
-
+ derivatives : null,
+
+ opened : null,
+
+ composedFrom : null,
+
+
+ initialize : function (props) {
+ Joose.Managed.PropertySet.Mutable.superClass.initialize.call(this, props)
+
+ //initially opened
+ this.opened = 1
+ this.derivatives = {}
+ this.ID = __ID__++
+ this.composedFrom = []
+ },
+
+
+ addComposeInfo : function () {
+ this.ensureOpen()
- addComposeInfo : function () {
- this.ensureOpen()
+ Joose.A.each(arguments, function (arg) {
+ this.composedFrom.push(arg)
- Joose.A.each(arguments, function (arg) {
- this.composedFrom.push(arg)
+ var propSet = arg instanceof Joose.Managed.PropertySet ? arg : arg.propertySet
- var propSet = arg instanceof Joose.Managed.PropertySet ? arg : arg.propertySet
-
- propSet.derivatives[this.ID] = this
- }, this)
- },
-
+ propSet.derivatives[this.ID] = this
+ }, this)
+ },
+
+
+ removeComposeInfo : function () {
+ this.ensureOpen()
- removeComposeInfo : function () {
- this.ensureOpen()
+ Joose.A.each(arguments, function (arg) {
- Joose.A.each(arguments, function (arg) {
-
- var i = 0
-
- while (i < this.composedFrom.length) {
- var propSet = this.composedFrom[i]
- propSet = propSet instanceof Joose.Managed.PropertySet ? propSet : propSet.propertySet
-
- if (arg == propSet) {
- delete propSet.derivatives[this.ID]
- this.composedFrom.splice(i, 1)
- } else i++
- }
+ var i = 0
+
+ while (i < this.composedFrom.length) {
+ var propSet = this.composedFrom[i]
+ propSet = propSet instanceof Joose.Managed.PropertySet ? propSet : propSet.propertySet
- }, this)
- },
-
-
- ensureOpen : function () {
- if (!this.opened) throw "Mutation of closed property set: [" + this.name + "]"
- },
-
-
- addProperty : function (name, props) {
- this.ensureOpen()
+ if (arg == propSet) {
+ delete propSet.derivatives[this.ID]
+ this.composedFrom.splice(i, 1)
+ } else i++
+ }
- return Joose.Managed.PropertySet.Mutable.superClass.addProperty.call(this, name, props)
- },
-
+ }, this)
+ },
- addPropertyObject : function (object) {
- this.ensureOpen()
-
- return Joose.Managed.PropertySet.Mutable.superClass.addPropertyObject.call(this, object)
- },
+
+ ensureOpen : function () {
+ if (!this.opened) throw "Mutation of closed property set: [" + this.name + "]"
+ },
+
+
+ addProperty : function (name, props) {
+ this.ensureOpen()
+ return Joose.Managed.PropertySet.Mutable.superClass.addProperty.call(this, name, props)
+ },
+
+
+ addPropertyObject : function (object) {
+ this.ensureOpen()
- removeProperty : function (name) {
- this.ensureOpen()
-
- return Joose.Managed.PropertySet.Mutable.superClass.removeProperty.call(this, name)
- },
+ return Joose.Managed.PropertySet.Mutable.superClass.addPropertyObject.call(this, object)
+ },
+
+
+ removeProperty : function (name) {
+ this.ensureOpen()
+ return Joose.Managed.PropertySet.Mutable.superClass.removeProperty.call(this, name)
+ },
+
+
+ composeFrom : function () {
+ this.ensureOpen()
- composeFrom : function () {
- this.ensureOpen()
-
- return Joose.Managed.PropertySet.Mutable.superClass.composeFrom.apply(this, this.composedFrom)
- },
+ return Joose.Managed.PropertySet.Mutable.superClass.composeFrom.apply(this, this.composedFrom)
+ },
+
+
+ open : function () {
+ this.opened++
+ if (this.opened == 1) {
- open : function () {
- this.opened++
+ Joose.O.each(this.derivatives, function (propSet) {
+ propSet.open()
+ })
- if (this.opened == 1) {
-
- Joose.O.each(this.derivatives, function (propSet) {
- propSet.open()
- })
-
- this.deCompose()
- }
- },
-
+ this.deCompose()
+ }
+ },
+
+
+ close : function () {
+ if (!this.opened) throw "Unmatched 'close' operation on property set: [" + this.name + "]"
- close : function () {
- if (!this.opened) throw "Unmatched 'close' operation on property set: [" + this.name + "]"
+ if (this.opened == 1) {
+ this.reCompose()
- if (this.opened == 1) {
- this.reCompose()
-
- Joose.O.each(this.derivatives, function (propSet) {
- propSet.close()
- })
- }
- this.opened--
- },
-
-
- reCompose : function () {
- this.composeFrom()
- },
-
-
- deCompose : function () {
- this.eachOwn(function (property, name) {
- if (property.definedIn != this) this.removeProperty(name)
- }, this)
+ Joose.O.each(this.derivatives, function (propSet) {
+ propSet.close()
+ })
}
-
- }).c
+ this.opened--
+ },
-})()
-
+ reCompose : function () {
+ this.composeFrom()
+ },
+
+
+ deCompose : function () {
+ this.eachOwn(function (property, name) {
+ if (property.definedIn != this) this.removeProperty(name)
+ }, this)
+ }
+
+}).c

0 comments on commit 870fc1f

Please sign in to comment.