New API: JsonResponseMerger.RegisterMergeCallback

March 24, 2016 10:43 am Published by Leave your thoughts

Starting 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:

  1. 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.
  2. 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 for AppName (used in workspaces) and Layout (used in layout editor)
  • a659678 – upgrade to Launcher’s starcounter-include 0.4.1 that uses PartialId and Layout 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:

This post was written by Marcin Warpechowski

Leave a Reply

Your email address will not be published. Required fields are marked *