Modules declare their run-time capabilities (e.g. which Intent actions they handle) in the module facet of their component manifest (i.e. their .cmx
file).
Component facets are sections in the component manifest which aren't consumed directly by the component manager, but are left to be defined and consumed by other parts of Fuchsia. The Modular framework defines a fuchsia.module
facet which module authors use to define module specific properties.
This document describes how to declare a module facet in your component manifest.
The following is an excerpt of a component manifest that defines a module facet.
{ "facets": { "fuchsia.module": { "@version": 2, "suggestion_headline": "See details about person", "intent_filters": [ { "action": "com.google.fuchsia.preview.v1", "parameters": [ { "name": "entityToPreview", "type": "https://fuchsia.com/types/Friend" } ] } ], "composition_pattern": "ticker" } } }
This module can be launched using an Intent with the action com.google.fuchsia.preview.v1
action, and a entityToPreview
parameter of type https://fuchsia.com/types/Friend
.
The module facet is defined under the fuchsia.module
facet in a component manifest. See example.
@version
unsigned integer (required)@version
they require.2
composition_pattern
: string (optional)@version
: 1ticker
: Show the module at the bottom of the screen underneath another module.comments-right
: show the module to the right of other modules."ticker"
suggestion_headline
: string (optional)@version
: 2"See details about this person"
placeholder_color
: string (optional)@version
: 2#
)"#ff00ff"
intent_filters
: IntentFilter[] (optional)@version
: 2IntentFilter
is a JSON object used to describe an intent type that a module is able to handle. The following describes the fields of the IntentFilter JSON object:
action
: string (required)@version
: 2parameters
: ParameterConstraint[] (required)@version
: 2ParameterConstraint
describes a particular intent parameter‘s name, and it’s acceptable type.
name
: string (required)@version
: 2type
: string (required)@version
: 2See example.