Explorar el Código

AxonBase >> changedAll

Herbert Vojčík hace 9 años
padre
commit
4afb3889ad
Se han modificado 4 ficheros con 53 adiciones y 9 borrados
  1. 38 1
      src/Axon.js
  2. 11 4
      src/Axon.st
  3. 3 3
      src/Trapped-Backend.js
  4. 1 1
      src/Trapped-Backend.st

+ 38 - 1
src/Axon.js

@@ -70,13 +70,50 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anAspect"],
-source: "changed: anAspect\x0a\x09| needsToRun |\x0a    needsToRun := false.\x0a\x09self do: [ :each |\x0a\x09\x09(each accepts: anAspect) ifTrue: [\x0a\x09\x09\x09each flag.\x0a            needsToRun := true.\x0a\x09\x09]\x0a\x09].\x0a\x09self dirty: needsToRun",
+source: "changed: anAspect\x0a\x09| needsToRun |\x0a\x09needsToRun := false.\x0a\x09self do: [ :each |\x0a\x09\x09(each accepts: anAspect) ifTrue: [\x0a\x09\x09\x09each flag.\x0a\x09\x09\x09needsToRun := true ]].\x0a\x09self dirty: needsToRun",
 referencedClasses: [],
 //>>excludeEnd("ide");
 messageSends: ["do:", "ifTrue:", "accepts:", "flag", "dirty:"]
 }),
 $globals.AxonBase);
 
+$core.addMethod(
+$core.method({
+selector: "changedAll",
+protocol: 'action',
+fn: function (){
+var self=this;
+var needsToRun;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+needsToRun=false;
+self._do_((function(each){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+$recv(each)._flag();
+needsToRun=true;
+return needsToRun;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
+//>>excludeEnd("ctx");
+}));
+self._dirty_(needsToRun);
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"changedAll",{needsToRun:needsToRun},$globals.AxonBase)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "changedAll\x0a\x09| needsToRun |\x0a\x09needsToRun := false.\x0a\x09self do: [ :each |\x0a\x09\x09each flag.\x0a\x09\x09needsToRun := true ].\x0a\x09self dirty: needsToRun",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["do:", "flag", "dirty:"]
+}),
+$globals.AxonBase);
+
 $core.addMethod(
 $core.method({
 selector: "dirty:",

+ 11 - 4
src/Axon.st

@@ -24,13 +24,20 @@ addInterest: anInterest
 
 changed: anAspect
 	| needsToRun |
-    needsToRun := false.
+	needsToRun := false.
 	self do: [ :each |
 		(each accepts: anAspect) ifTrue: [
 			each flag.
-            needsToRun := true.
-		]
-	].
+			needsToRun := true ]].
+	self dirty: needsToRun
+!
+
+changedAll
+	| needsToRun |
+	needsToRun := false.
+	self do: [ :each |
+		each flag.
+		needsToRun := true ].
 	self dirty: needsToRun
 !
 

+ 3 - 3
src/Trapped-Backend.js

@@ -428,7 +428,7 @@ var self=this;
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 self["@payload"]=anObject;
-self._changed_([]);
+$recv(self._axon())._changedAll();
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"model:",{anObject:anObject},$globals.Trapper)});
@@ -436,10 +436,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anObject"],
-source: "model: anObject\x0a\x09payload := anObject.\x0a    self changed: #()",
+source: "model: anObject\x0a\x09payload := anObject.\x0a    self axon changedAll",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["changed:"]
+messageSends: ["changedAll", "axon"]
 }),
 $globals.Trapper);
 

+ 1 - 1
src/Trapped-Backend.st

@@ -123,7 +123,7 @@ and must issue these calls when initializing:
 
 model: anObject
 	payload := anObject.
-    self changed: #()
+    self axon changedAll
 ! !
 
 !Trapper methodsFor: 'action'!