@@ -19,22 +19,22 @@ You need to do those actions in a `#startUp:` method and `#shutDown:` method on
19
19
20
20
``` Smalltalk
21
21
MyClass class>>startUp: isImageStarting
22
- isImageStarting
23
- ifTrue: [ MyVariable := FileLocator home asFileReference ]
22
+ isImageStarting
23
+ ifTrue: [ MyVariable := FileLocator home asFileReference ]
24
24
```
25
25
26
26
``` Smalltalk
27
27
MyClass class>>shutDown: isImageQuitting
28
- isImageQuitting
29
- ifTrue: [ MyVarible := nil ]
28
+ isImageQuitting
29
+ ifTrue: [ MyVarible := nil ]
30
30
```
31
31
32
32
Then you need to register the class in the ` SessionManager ` of Pharo. This is usually done in the ` #initialize ` method (class-side).
33
33
34
34
``` Smalltalk
35
35
MyClass class>>initialize
36
- SessionManager default registerUserClassNamed: self name.
37
- self startUp: true. "Here we execute it to set up the value while loading the project."
36
+ SessionManager default registerUserClassNamed: self name.
37
+ self startUp: true. "Here we execute it to set up the value while loading the project."
38
38
```
39
39
40
40
## Register a class to the session manager
@@ -45,14 +45,14 @@ The simplest way to do that is to add this in the class initialization method of
45
45
46
46
``` Smalltalk
47
47
MyClass class>>initialize
48
- SessionManager default registerUserClassNamed: self name
48
+ SessionManager default registerUserClassNamed: self name
49
49
```
50
50
51
51
Sometimes, the order of execution of start-up/shut-down actions might matter. To manage this, it is possible to set a priority.
52
52
53
53
``` Smalltalk
54
54
MyClass class>>initialize
55
- SessionManager default registerUserClassNamed: self name atPriority: 60
55
+ SessionManager default registerUserClassNamed: self name atPriority: 60
56
56
```
57
57
Registered handlers with lower priority will be executed first.
58
58
The actions registered using ` #registerUserClassNamed:[atPriority:] ` will have a low priority in the startup/shutdown list.
0 commit comments