API Reference
Configuration File Winnetoujs package Constructos Mutables State Management Mutations Select Methods Winnetou Fx Router Translations Color Themes WBR Compiler
Docs Change Log Git Hub Pull Requests Guidelines Get in touch

Mutations Constructos Removal Watch


Available since: 1.19.0

∯ Purpose

To call a function when a constructo was removed from DOM.

Syntax

Winnetou.mutations.start();

Winnetou.mutations.onRemove(id: String, callback: Function);

Winnetou.mutations.destroy()

start

Initiates watching DOM changes.

onRemove

Adds a listener to specific constructo that fires when it was removed from DOM.

destroy

Deletes mutations watching. Take when use destroy because it eliminates ALL mutations listeners on entire app.

Example

mutables.js
  
  import {Winnetou} from 'winnetoujs';
  import {profileCard} from './constructos/profile.js';
  ...

  let profile = profileCard({
    name:`John`
  }).create(`#app`);

  Winnetou.mutations.start();
  Winnetou.mutations.onRemove(profile.ids.profileCard, () => {
    console.log(`Profile was removed from dom.`)
  });
  Winnetou.mutations.destroy();