Packages

c

com.raquo.airstream.ownership

TransferableSubscription

class TransferableSubscription extends AnyRef

This subscription is hyper dynamic, allowing you to change DynamicOwner on the fly.

It works by creating DynamicSubscription-s under the hood with your provided owner and activate() and deactivate() methods, but it has a special semantic: when transferring this subscription from one active DynamicOwner to another active DynamicOwner, neither activate() nor deactivate() are called because continuity of active ownership is maintained.

So in effect, this subscription only cares whether it's owned or not, so it does not expose the owner to you: notice the activate callback is not provided with an Owner.

An example of where this is useful is tracking mounting and unmounting of elements in Laminar. If an element is mounted, we want to call activate(), if unmounted, we want to call deactivate(), but if the element is MOVED from one mounted parent to another mounted parent, it just remains mounted, this transition is of no interest to us. If not for this subscription's special design, we would need to call deactivate() to "detach" the subscription from its old parent's owner and then immediately afterwards call activate() to "attach" the subscription to the new parent's owner, but that would deactivate and then immediately re-activate all subscriptions on the Laminar element being moved (and all of its descendants), which would be very wasteful. Well, you do need to know Laminar to understand this example.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TransferableSubscription
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new TransferableSubscription(activate: () => Unit, deactivate: () => Unit)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clearOwner(): Unit
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. def hasOwner: Boolean
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def isCurrentOwnerActive: Boolean
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. def setOwner(nextOwner: DynamicOwner): Unit

    Update the owner of this subscription.

  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped