-
Notifications
You must be signed in to change notification settings - Fork 77
Migrating Seaside Javascript wrappers to 3.6.0
Seaside 3.6.0 changed the implementation of the Javascript code generation to use a canvas with brushes instead of writing characters onto a stream. While the existing API of the JSObject hierarchy for Javascript generation remains unchanged, developers of Javascript wrappers or any Seaside user who implements javascriptContentOn: or javascriptOn: methods needs to migrate their implementation of these methods from a Stream type argument to a JSCanvas type argument.
Prior to 3.6.0, Javascript generation was performed on an intermediate String instance which was then written onto the response document. The creation of an intermediate String is now avoided which improves memory use and the response speed. In particular when generating JQuery DOM manipulation scripts, the generated Javascript code often includes large strings with embedded html. This change also allowed to move the implementation of the Javascript string encoding (which was located on the JSStream class) to the WAEncoder hierarchy, contributing to a more uniform implementation of escaping/encoding of html, Json and Javascript in Seaside.
Review and change all your custom implementations of javascriptOn: and javascriptContentOn: to use JsCanvas type argument.
If this is your original method implementation that writes to aStream:
javascriptContentOn: aStream
"original code writing to aStream"You can patch it as follows, quick-and-easy:
javascriptContentOn: aJsCanvas
aJsCanvas javascript: (String streamContents: [:aStream | "original code writing to aStream" ])But that will again create an intermediate string. This might not be an issue in your case, so it could be perfectly fine.
If your generated string can be large, then consider using the JsJavascriptCanvas api to adapt your existing code to a canvas-with-brushes implementation. You can check out the example javascriptContentOn: methods for JsObject as an inspiration.
Changelogs
- (newer changelogs, see https://github.com/SeasideSt/Seaside/releases)
- 3.4.0
- 3.3.0
- 3.2.4
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.11
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 2.8
- 2.7
- Past Releases
Development
Documentation
- Configuration and Preferences
- Embedding Subcomponents
- Maintaining State
- Generating HTML
- CSS and Javascript
- Debugging Seaside Applications
- Links, Forms and Callbacks
- Development Tools
- Call and Answer
- Naming URLs
- Security Features
- Securing Seaside Applications
- Seaside-REST
- Add-On Libraries
- Persistence
- Gettext
- FileLibrary
- The Render Tree
- PDF Generation
- Long-Term Issues
- Ajaxification
- Web Components
- Big Issues
Sprints