New API: JsonResponseMerger.RegisterMergeCallback
March 24, 2016 10:43 am Leave your thoughtsStarting from Starcounter 2.1.1527 nightly, a new API JsonResponseMerger.RegisterMergeCallback
is available.
The API allows a callback to be registered that is triggered when one or more responses containing Json
is returned and merged from a Self.GET
. The implementer of the callback can then inspect the Json-responses and return an additional Json
that will be included in the final response.
How is Launcher affected?
One app that uses this mechanism is Launcher. Launcher uses the callback for two reasons:
- Track the information about what application is now displayed on screen. In other words: what is the current workspace. This happens at the root level of Launcher’s view-model.
- Load and save a custom layout for the currently displayed page. This happens at every level in the Json tree that was obtained using
Self.GET
.
If you run a modified version of Launcher, you will need to pull changes from Launcher repository, specifically:
- 0e02c19 – switch Launcher server-side code to use
JsonResponseMerger.RegisterMergeCallback
instead of the previous mechanism - aca346a – consistently use response in
Launcher
JSON namespace as the source information forAppName
(used in workspaces) andLayout
(used in layout editor) - a659678 – upgrade to Launcher’s starcounter-include 0.4.1 that uses
PartialId
andLayout
from the new location in the JSON tree
There are also other interesting changes in Launcher after 3.1.6 (new way to switch workspaces), so it is recommended to pull all of the changes to your versions of Launcher.
Which Launcher version to use?
When you are on Starcounter older than 2.1.1527, you should use Launcher 3.1.6. When you are on Starcounter 2.1.1527 or newer, you should use Launcher master
branch from GitHub (soon to be released as Launcher 4.0.0).
Categorised in: Uncategorized
This post was written by Marcin Warpechowski