Class: share.CommonComponentBase
Defined in: | base.coffee |
Inherits: | BlazeComponent |
Overview
A common base class for both CommonComponent and CommonMixin.
Direct Known Subclasses
Instance Method Summary
- # (SubscriptionHandle) subscribe(name, args...) A version of subscribe which logs errors to the console if no error callback is specified.
- # (BlazeComponent) ancestorComponent(nameOrComponent) Traverses the components tree towards the root and returns the first component which matches the provided component name, class, or instance.
-
#
(BlazeComponent)
ancestorComponentWith(propertyOrMatcherOrFunction)
Traverses the components tree towards the root and finds the first component which matches a
propertyOrMatcherOrFunction
predicate. -
#
(anything)
callAncestorWith(propertyName, args...)
Traverses the components tree towards the root and finds the first component (or its mixin) with a property
propertyName
, and if it is a function, calls it withargs
arguments, otherwise returns the value of the property.
Instance Method Details
#
(SubscriptionHandle)
subscribe(name, args...)
A version of subscribe which logs errors to the console if no error callback is specified.
#
(BlazeComponent)
ancestorComponent(nameOrComponent)
Traverses the components tree towards the root and returns the first component which matches the provided component name, class, or instance.
Returns null
if such component is not found.
It returns a strict ancestor, it does not check the component itself first.
#
(BlazeComponent)
ancestorComponentWith(propertyOrMatcherOrFunction)
Traverses the components tree towards the root and finds the first component which matches a
propertyOrMatcherOrFunction
predicate.
Returns null
if such component is not found.
A propertyOrMatcherOrFunction
predicate can be:
- a property name string, in this case the first component which has a property with the given name (or its mixins do) is matched
- a matcher object specifying mapping between property names and their values, in this case the first component which (or its mixins) has all properties from the matcher object equal to given values is matched (if a property is a function, it is called and its return value is compared instead)
- a function which receives
(ancestor, component)
withthis
bound tocomponent
, in this case the first component for which the function returns a true value is matched
It returns a strict ancestor, it does not check the component itself first.
#
(anything)
callAncestorWith(propertyName, args...)
Traverses the components tree towards the root and finds the first component (or its mixin) with a property propertyName
,
and if it is a function, calls it with args
arguments, otherwise returns the value of the property.
Returns undefined
if such component is not found.
It calls a strict ancestor, it does not check the component itself first.