Browse Source

Refactor former registerIn:.

Herbert Vojčík 6 years ago
parent
commit
129fec7575

+ 3 - 3
example-counter/src/Trapped-Counter.js

@@ -82,8 +82,8 @@ $ctx1.supercall = true,
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = false;
 //>>excludeEnd("ctx");;
-$recv($recv($globals.SimpleAxon)._new())._registerIn_(self);
 $self["@value"]=(0);
+$self._axxord_($recv($globals.SimpleAxon)._new());
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TrappedCounter)});
@@ -91,10 +91,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "initialize\x0a\x09super initialize.\x0a\x09SimpleAxon new registerIn: self.\x0a\x09value := 0",
+source: "initialize\x0a\x09super initialize.\x0a\x09value := 0.\x0a\x09self axxord: SimpleAxon new",
 referencedClasses: ["SimpleAxon"],
 //>>excludeEnd("ide");
-messageSends: ["initialize", "registerIn:", "new"]
+messageSends: ["initialize", "axxord:", "new"]
 }),
 $globals.TrappedCounter);
 

+ 2 - 2
example-counter/src/Trapped-Counter.st

@@ -28,7 +28,7 @@ increment
 
 initialize
 	super initialize.
-	SimpleAxon new registerIn: self.
-	value := 0
+	value := 0.
+	self axxord: SimpleAxon new
 ! !
 

+ 3 - 3
example-todo/src/Trapped-Todo.js

@@ -88,7 +88,6 @@ $ctx1.supercall = true,
 $ctx1.supercall = false;
 //>>excludeEnd("ctx");;
 axon=$recv($globals.SimpleAxon)._new();
-$recv(axon)._registerIn_(self);
 $recv(axon)._addInterest_($recv($globals.TrappedPosition)._interestOn_block_([["todos"], nil],(function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
@@ -113,6 +112,7 @@ return [$globals.HashedCollection._newFromPairs_(["text","learn trapped","done",
 $self["@title"]="Todo";
 $self["@todoText"]=nil;
 $self["@todos"]=nil;
+$self._axxord_(axon);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"initialize",{axon:axon},$globals.TrappedTodo)});
@@ -120,10 +120,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "initialize\x0a\x09| axon |\x0a\x09super initialize.\x0a\x0a    axon := SimpleAxon new.\x0a\x09axon registerIn: self.\x0a\x09\x0a\x09axon addInterest: (TrappedPosition\x0a\x09\x09interestOn: #((todos) nil)\x0a\x09\x09block: [ axon changed: #((remaining)) ]).\x0a\x0a    [ self axes: #((todos)) transform: [{\x0a        #{'text'->'learn trapped'. 'done'->true}.\x0a        #{'text'->'build a trapped app'. 'done'->false}\x0a    }]] valueWithTimeout: 2000.\x0a\x0a\x09title := 'Todo'.\x0a\x09todoText := nil.\x0a\x09todos := nil",
+source: "initialize\x0a\x09| axon |\x0a\x09super initialize.\x0a\x0a    axon := SimpleAxon new.\x0a\x09\x0a\x09axon addInterest: (TrappedPosition\x0a\x09\x09interestOn: #((todos) nil)\x0a\x09\x09block: [ axon changed: #((remaining)) ]).\x0a\x0a    [ self axes: #((todos)) transform: [{\x0a        #{'text'->'learn trapped'. 'done'->true}.\x0a        #{'text'->'build a trapped app'. 'done'->false}\x0a    }]] valueWithTimeout: 2000.\x0a\x0a\x09title := 'Todo'.\x0a\x09todoText := nil.\x0a\x09todos := nil.\x0a\x0a\x09self axxord: axon",
 referencedClasses: ["SimpleAxon", "TrappedPosition"],
 //>>excludeEnd("ide");
-messageSends: ["initialize", "new", "registerIn:", "addInterest:", "interestOn:block:", "changed:", "valueWithTimeout:", "axes:transform:"]
+messageSends: ["initialize", "new", "addInterest:", "interestOn:block:", "changed:", "valueWithTimeout:", "axes:transform:", "axxord:"]
 }),
 $globals.TrappedTodo);
 

+ 3 - 2
example-todo/src/Trapped-Todo.st

@@ -84,7 +84,6 @@ initialize
 	super initialize.
 
     axon := SimpleAxon new.
-	axon registerIn: self.
 	
 	axon addInterest: (TrappedPosition
 		interestOn: #((todos) nil)
@@ -97,7 +96,9 @@ initialize
 
 	title := 'Todo'.
 	todoText := nil.
-	todos := nil
+	todos := nil.
+
+	self axxord: axon
 ! !
 
 !TrappedProcessor class methodsFor: '*Trapped-Todo'!

+ 3 - 3
src/Trapped.js

@@ -413,7 +413,7 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-$recv($recv($self._model())._registeredAxon())._addInterest_($recv($self._class())._interestOn_block_($self._path(),(function(){
+$recv($recv($self._model())._axxord())._addInterest_($recv($self._class())._interestOn_block_($self._path(),(function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
@@ -429,10 +429,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aBlock"],
-source: "watch: aBlock\x0a\x09self model registeredAxon addInterest: (self class\x0a\x09\x09interestOn: self path\x0a\x09\x09block: [ self read: aBlock ])",
+source: "watch: aBlock\x0a\x09self model axxord addInterest: (self class\x0a\x09\x09interestOn: self path\x0a\x09\x09block: [ self read: aBlock ])",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["addInterest:", "registeredAxon", "model", "interestOn:block:", "class", "path", "read:"]
+messageSends: ["addInterest:", "axxord", "model", "interestOn:block:", "class", "path", "read:"]
 }),
 $globals.TrappedPosition);
 

+ 1 - 1
src/Trapped.st

@@ -106,7 +106,7 @@ read: aBlock
 !
 
 watch: aBlock
-	self model registeredAxon addInterest: (self class
+	self model axxord addInterest: (self class
 		interestOn: self path
 		block: [ self read: aBlock ])
 ! !