Context objects - Limitations

2025-02-07

This feature comes with some limitations.

Types

The following types are supported for properties, and method/signal parameters:

  • string
  • int/float
  • bool
  • array
  • dictionary
  • vector2/3/4/, 2i/3i/4i
  • nil

Unsupported types

Some unsupported types are (possibly others):

  • Transform3D
  • Object
  • Basis
  • Quaternion

Array and Dictionaries

important: both Array and Dictionary do not support nesting. For example, having a property like this is not possible:

var nested_dict: Dictionary = {
    "player": {
        "name": "Hero",
        "health": 100,
        "inventory": {
            "gold": 50,
            "weapons": ["sword", "shield"]
        }
    }
}

Dictionaries and arrays should be flat. This limitation comes from our focus on performance, and also because nesting complicated the implementation too much.

Performance

In our implementation, property values are represented by their C++ equivalent from std. There is no serialization happening via JSON or some such. Property updates we timed under 1ms.

Do note that at a webview refresh rate of 60fps, this is 16ms per frame, so even if the javascript runtime receives updates in a timely manner, the renderer still requires 1 frame to display any visual change you may have caused via the property update.

Due to IPC architecture there are some unavoidable copies involved in moving the data around. We do not have a shared memory model with the javascript runtime like ultralight. However, as described above, we tried to make it as fast as possible.