Type of the components properties object. By default, it contains an optional
children
property of type any
. This allows components that don't explicitly specify any
type, to accept children. Note that if a component provides its own type for the properties
object and wants to accept children, this type must have the children
property of the desired
type. If not, the component will not be able to accept children (which, oftentimes, might be a
desired behavior).
Interface defining the component's event. This interface should map event
names (e.g. "change") to the types of event objects. The event object types could be either
types derived from the built-in Event type, in which case this will be the type passed to the
event handler function. If the event object type doesn't derive from the built-in Event type,
then the CustomEvent object will be passed to the event handler function with its detail
property of the specified type.
Determines whether the component is currently mounted. If a component has asynchronous functionality (e.g. fetching data from a server), component's code may be executed after it was already unmounted. This property allows the component to handle this situation.
Component properties passed to the constructor. This is normally used only by managed components and is usually undefined for independent components.
Remembered virtual node object through which the component can request services. This is undefined in the component's costructor but will be defined before the call to the (optional) willMount method.
Schedules the given function to be called either before or after components update cycle.
Function to be called
If true, the function is called before the component updates cycle; if false - after the cycle.
Argument that will be passed to the function.
Object that will be used as "this" value when the function is called. If this parameter is undefined, the component instance will be used (which allows scheduling regular unbound components' methods). This parameter will be ignored if the function is already bound or is an arrow function.
Defines whether and how Mimbl tick is scheduled after the function is called
Fires an event of the given type. The detail
parameter is interpreted differently for
built-in and custom events. For built-in events (that is, events whose type derives from
Event), this is the event object itself. For custom events, it becomes the value of the
detail
property of the CustomEvent object.
Defines a range of possible values for the eventType
parameter. K is a key
from the TEvent
type.
Event type name, which is a key from the TEvents
type
Event data, whose type is defined by the type mapped to the key
in the TEvents
type.
Retrieves the value for a service with the given ID registered by a closest ancestor component or the default value if none of the ancestor components registered a service with this ID. This method doesn't establish a subscription and only reflects the current state.
Unique service identifier
Default value to return if no publish service is found.
Flag indicating whether the search for the service should start from the
virtual node that calls this method. The default value is false
meaning the search starts
from the parent virtual node.
Current value of the service or default value if no published service is found.
Registers the given value as a service with the given ID that will be available for consumption by descendant components.
Unique service identifier
Current value of the service
Number of level to watch for changes. The default value is 1; that is, the subscribers will be notified if the service's value or the values of its properties have changed.
Publication object, which allows setting a new value of the service or changing values of its properties.
Returns the component's content that will be ultimately placed into the DOM tree. This method is abstract because it must be implemented by every component.
Subscribes to a service with the given ID. If the service with the given ID is registered
by this or one of the ancestor components, the returned subscription object's value
property will reference it; otherwise, the value will be set to the defaultValue (if
specified) or will remain undefined. Whenever the value of the service that is registered by
this or a closest ancestor component is changed, the subscription's value
property will
receive the new value.
If the subscription object's value
property is used in a component's rendering code, the
component will be re-rendered every time the service value is changed.
Unique service identifier
Optional default value that will be assigned if the service is not published yet.
Flag indicating whether the search for the service should start from the
virtual node that calls this method. The default value is false
meaning the search starts
from the parent virtual node.
Subscription object, which provides the value of the service and allowes attaching to the event fired when the value is changed.
This method is called by the component to request to be updated.
Callback function to be wrapped
Optional argument to be passed to the callback in addition to the original callback arguments.
Optional object to be used as this
when calling the callback. If this
parameter is not defined, the component instance is used, which allows wrapping regular
unbound components' methods. This parameter will be ignored if the the function is already
bound or is an arrow function.
Type of scheduling the Mimbl tick after the callback function returns.
Wrapped callback that will run the original callback in the proper context.
Base class for components. Components must derive from this class and must implement the render method.