Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface InterfaceHTMLElements$

Hierarchy

  • InterfaceHTMLElements$

Index

Methods

Methods

ownSubscription

  • ownSubscription(sub: Subscription): any
  • The provided subscription get owned by the element: it will be unsubscribed when the element is removed from the DOM.

    Typically:

    • let clicked$ = new rxjs.BehaviorSubject({clicked: false})
      let vDOM = {
        tag: 'div',
        connectedCallback: (elem: HTMLElement$) => {
            // the ownership of sub0 is given to the VirtualDOM
            // => it will be unsubscribed when element is actually removed from the view
            elem.ownSubscription(clicked$.subscribe( (d) => console.log(d)))
        }
        children: [
            {
                tag:'button',
                innerText: 'hello flux view',
                onclick: () => clicked$.next({clicked: true})
            }]
      }
      
      @param sub subscription

    Parameters

    • sub: Subscription

    Returns any

Generated using TypeDoc