Skip to content

Commit

Permalink
Extract 2 examples to Bloc-Taskit-Examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed May 17, 2024
1 parent 365b6db commit f70c6d4
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 56 deletions.
63 changes: 63 additions & 0 deletions src/Bloc-Taskit-Tests/TKTBlocExamples.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Class {
#name : #TKTBlocExamples,
#superclass : #BlExamplesTest,
#category : #'Bloc-Taskit-Tests'
}

{ #category : #examples }
TKTBlocExamples >> runnerExample [
<sampleInstance>

| space runner |
space := BlSpace new.
space
extent: 100@100;
show.

runner := TKTBlSpaceRunner on: space.

[ 17 timesRepeat: [
runner schedule: [
space root background: Color random ] asTask.
250 milliSeconds wait ].

runner stop.
space close ] fork

" We kind of emulate this:
space
enqueueTask:
(BlRepeatedTaskAction new
delay: 250 milliSeconds;
action: [ space root background: Color random ];
yourself)."
]

{ #category : #examples }
TKTBlocExamples >> serviceExample [
<sampleInstance>

| space service |
space := BlSpace new.
space
extent: 100@100;
show.

service := TKTBlSpaceService on: space.

service step: [ space root background: Color random ].
service stepDelay: 250 milliSeconds.
service start.

[ 3 seconds wait.
service stop.
space close ] fork

" We kind of emulate this:
space
enqueueTask:
(BlRepeatedTaskAction new
delay: 250 milliSeconds;
action: [ space root background: Color random ];
yourself)."
]
1 change: 1 addition & 0 deletions src/Bloc-Taskit-Tests/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Bloc-Taskit-Tests' }
28 changes: 0 additions & 28 deletions src/Bloc-Taskit/TKTBlSpaceRunner.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,6 @@ Class {
#category : #'Bloc-Taskit-Objects'
}

{ #category : #examples }
TKTBlSpaceRunner class >> example1 [

| space runner |
space := BlSpace new.
space
extent: 100@100;
show.

runner := TKTBlSpaceRunner on: space.

[ 17 timesRepeat: [
runner schedule: [
space root background: Color random ] asTask.
250 milliSeconds wait ].

runner stop.
space close ] fork

" We kind of emulate this:
space
enqueueTask:
(BlRepeatedTaskAction new
delay: 250 milliSeconds;
action: [ space root background: Color random ];
yourself)."
]

{ #category : #'instance creation' }
TKTBlSpaceRunner class >> on: aBlSpace [

Expand Down
28 changes: 0 additions & 28 deletions src/Bloc-Taskit/TKTBlSpaceService.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,6 @@ Class {
#category : #'Bloc-Taskit-Objects'
}

{ #category : #examples }
TKTBlSpaceService class >> example1 [

| space service |
space := BlSpace new.
space
extent: 100@100;
show.

service := TKTBlSpaceService on: space.

service step: [ space root background: Color random ].
service stepDelay: 250 milliSeconds.
service start.

[ 3 seconds wait.
service stop.
space close ] fork

" We kind of emulate this:
space
enqueueTask:
(BlRepeatedTaskAction new
delay: 250 milliSeconds;
action: [ space root background: Color random ];
yourself)."
]

{ #category : #'instance creation' }
TKTBlSpaceService class >> on: aBlSpace [

Expand Down

0 comments on commit f70c6d4

Please sign in to comment.