Skip to main content
Version: 2.13

Get Closest Context

Return the closest parent context of the given type

Description​

The returned context is the closest parent which match the given model type. The model type must be a tag, or it can be one of the following utility name:

  • parent : return the closest parent, avoiding returning a soft-coded context from a lambda for exemple. You can think of this parent context like the parent composition context.
  • application : return the context of the running Application
  • screen : in UI app, return the context of the running screen

If no context is found, it will return the highest parent in the tree.

Inputs​

  • model type (String): Tag of the "type" of context that you are looking for. You can also provide the named value such as:

  • parent : return the closest parent, avoiding returning a soft-coded context from a lambda for exemple. You can think of this parent context like the parent composition context.

  • application : return the context of the running Application

  • screen : in UI app, return the context of the running screen

Outputs​

  • context (Context): The closest context found.