-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1444 from marschall/web-components-improvements
Improvements for Web Components
- Loading branch information
Showing
33 changed files
with
174 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
repository/Seaside-Session.package/WASessionContinuation.class/instance/restoreState.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
processing | ||
restoreState | ||
|
||
self states restore |
Empty file.
3 changes: 3 additions & 0 deletions
3
...easide-Tests-WebComponents.package/WASingleElementCacheTest.class/instance/createCache.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
private | ||
createCache | ||
^ WASingleElementCache new |
5 changes: 5 additions & 0 deletions
5
.../Seaside-Tests-WebComponents.package/WASingleElementCacheTest.class/instance/testClear.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
testing | ||
testClear | ||
cache at: 1 put: 'one'. | ||
cache clear. | ||
self assert: (cache at: 1 ifAbsent: [ 'two' ]) equals: 'two'. |
5 changes: 5 additions & 0 deletions
5
...ide-Tests-WebComponents.package/WASingleElementCacheTest.class/instance/testKeyAtValue.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
testing | ||
testKeyAtValue | ||
cache at: 1 put: 'one'. | ||
self assert: (cache keyAtValue: 'one' ifAbsent: [ 2 ]) equals: 1. | ||
self assert: (cache keyAtValue: 'two' ifAbsent: [ 2 ]) equals: 2. |
13 changes: 13 additions & 0 deletions
13
...ests-WebComponents.package/WASingleElementCacheTest.class/instance/testKeysAndValuesDo.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
testing | ||
testKeysAndValuesDo | ||
| reference readBack | | ||
reference := Dictionary new. | ||
|
||
cache at: 1 put: 'one'. | ||
reference at: 1 put: 'one'. | ||
|
||
readBack := Dictionary new. | ||
cache keysAndValuesDo: [ :key :value | | ||
readBack at: key put: value ]. | ||
|
||
self assert: readBack equals: reference |
7 changes: 7 additions & 0 deletions
7
...y/Seaside-Tests-WebComponents.package/WASingleElementCacheTest.class/instance/testSize.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
testing | ||
testSize | ||
self assert: cache size equals: 0. | ||
cache at: 1 put: 'one'. | ||
self assert: cache size equals: 1. | ||
cache at: 2 put: 'two'. | ||
self assert: cache size equals: 1. |
10 changes: 10 additions & 0 deletions
10
.../Seaside-Tests-WebComponents.package/WASingleElementCacheTest.class/instance/testStore.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
testing | ||
testStore | ||
| generator | | ||
generator := WAPrecomputedKeyGenerator keys: #(1 2 3). | ||
WAKeyGenerator | ||
use: generator | ||
during: [ | ||
self assert: (cache store: 'key1') equals: 1. | ||
self assert: (cache store: 'key2') equals: 2. | ||
self assert: (cache store: 'key3') equals: 3 ] |
11 changes: 11 additions & 0 deletions
11
...sitory/Seaside-Tests-WebComponents.package/WASingleElementCacheTest.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "WACacheTest", | ||
"category" : "Seaside-Tests-WebComponents", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "WASingleElementCacheTest", | ||
"type" : "normal" | ||
} |
1 change: 1 addition & 0 deletions
1
.../Seaside-WebComponents-Core.package/WASingleContinuationSession.class/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
I am a session that stores only a single continuation. I am usesful for cases where state snapshots are not used. |
3 changes: 3 additions & 0 deletions
3
...onents-Core.package/WASingleContinuationSession.class/instance/createContinuationCache.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
initialization | ||
createContinuationCache | ||
^ WASingleElementCache new |
11 changes: 11 additions & 0 deletions
11
...tory/Seaside-WebComponents-Core.package/WASingleContinuationSession.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"commentStamp" : "xxx 7/11/2024 13:25", | ||
"super" : "WASession", | ||
"category" : "Seaside-WebComponents-Core", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "WASingleContinuationSession", | ||
"type" : "normal" | ||
} |
1 change: 1 addition & 0 deletions
1
repository/Seaside-WebComponents-Core.package/WASingleElementCache.class/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
I am a cache that contains at most one element. |
5 changes: 5 additions & 0 deletions
5
...ry/Seaside-WebComponents-Core.package/WASingleElementCache.class/instance/at.ifAbsent..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
accessing | ||
at: aKey ifAbsent: aBlock | ||
^ key = aKey | ||
ifTrue: [ value ] | ||
ifFalse: [ aBlock value ] |
5 changes: 5 additions & 0 deletions
5
repository/Seaside-WebComponents-Core.package/WASingleElementCache.class/instance/at.put..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
putting | ||
at: aKey put: anObject | ||
key := aKey. | ||
value := anObject. | ||
^ anObject |
4 changes: 4 additions & 0 deletions
4
repository/Seaside-WebComponents-Core.package/WASingleElementCache.class/instance/clear.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public | ||
clear | ||
key := nil. | ||
value := nil |
5 changes: 5 additions & 0 deletions
5
...de-WebComponents-Core.package/WASingleElementCache.class/instance/keyAtValue.ifAbsent..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
accessing | ||
keyAtValue: anObject ifAbsent: aBlock | ||
^ value = anObject | ||
ifTrue: [ key ] | ||
ifFalse: [ aBlock value ] |
4 changes: 4 additions & 0 deletions
4
...easide-WebComponents-Core.package/WASingleElementCache.class/instance/keysAndValuesDo..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
enumerating | ||
keysAndValuesDo: aTwoArgumentBlock | ||
key isNil ifFalse: [ | ||
aTwoArgumentBlock value: key value: value ] |
5 changes: 5 additions & 0 deletions
5
repository/Seaside-WebComponents-Core.package/WASingleElementCache.class/instance/remove..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
removing | ||
remove: anObject | ||
value = anObject ifTrue: [ | ||
key := nil. | ||
value := nil ] |
5 changes: 5 additions & 0 deletions
5
repository/Seaside-WebComponents-Core.package/WASingleElementCache.class/instance/size.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
accessing | ||
size | ||
^ key isNil | ||
ifTrue: [ 0 ] | ||
ifFalse: [ 1 ] |
5 changes: 5 additions & 0 deletions
5
repository/Seaside-WebComponents-Core.package/WASingleElementCache.class/instance/store..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
putting | ||
store: anObject | ||
key := WAKeyGenerator current keyOfLength: self keySize. | ||
value := anObject. | ||
^ key |
14 changes: 14 additions & 0 deletions
14
repository/Seaside-WebComponents-Core.package/WASingleElementCache.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"commentStamp" : "xxx 7/11/2024 10:46", | ||
"super" : "WACache", | ||
"category" : "Seaside-WebComponents-Core", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"key", | ||
"value" | ||
], | ||
"name" : "WASingleElementCache", | ||
"type" : "normal" | ||
} |
7 changes: 7 additions & 0 deletions
7
...ide-WebComponents-Core.package/WAWebComponentActionContinuation.class/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
I am a special action continuation with optimizations for web components. | ||
|
||
Since web components have no back button and a full page reload results in an entire new page I perform the following optimizations. | ||
|
||
- I do not redirect. | ||
- I do not capture the state. | ||
- I do not restore the state. |
4 changes: 4 additions & 0 deletions
4
...onents-Core.package/WAWebComponentActionContinuation.class/instance/basicPerformAction.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
processing | ||
basicPerformAction | ||
super basicPerformAction. | ||
self renderContext callbacks handle: self requestContext |
4 changes: 4 additions & 0 deletions
4
...de-WebComponents-Core.package/WAWebComponentActionContinuation.class/instance/continue.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
processing | ||
continue | ||
"do not capture state" | ||
self createRenderContinuation handle: self requestContext |
3 changes: 3 additions & 0 deletions
3
...bComponents-Core.package/WAWebComponentActionContinuation.class/instance/jumpToAnchor..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public | ||
jumpToAnchor: aString | ||
"Intentionally empty for compatibility with WACallbackProcessingActionContinuation" |
3 changes: 3 additions & 0 deletions
3
...ebComponents-Core.package/WAWebComponentActionContinuation.class/instance/restoreState.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processing | ||
restoreState | ||
"don't restore states" |
3 changes: 3 additions & 0 deletions
3
...Components-Core.package/WAWebComponentActionContinuation.class/instance/shouldRedirect.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
private | ||
shouldRedirect | ||
^ false |
11 changes: 11 additions & 0 deletions
11
...Seaside-WebComponents-Core.package/WAWebComponentActionContinuation.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"commentStamp" : "xxx 7/11/2024 13:24", | ||
"super" : "WAActionPhaseContinuation", | ||
"category" : "Seaside-WebComponents-Core", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "WAWebComponentActionContinuation", | ||
"type" : "normal" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
...e-WebComponents-Examples.package/WAWebComponentsDemoApplication.class/class/initialize.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
initialization | ||
initialize | ||
(WAAdmin register: self asApplicationAt: 'examples/web-components') | ||
| application | | ||
"register such that we do not have the developer tools" | ||
application := WAAdmin register: WAApplication at: 'examples/web-components' in: WAAdmin defaultDispatcher. | ||
application configuration addParent: WARenderLoopConfiguration instance. | ||
application | ||
rootClass: self; | ||
scriptGeneratorClass: WANullScriptGenerator |