How to use the incremental-dom.notifications.nodesDeleted function in incremental-dom

To help you get started, we’ve selected a few incremental-dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spectjs / spect / src / html.js View on Github external
elementVoid,
  currentPointer,
  skipNode,
  notifications
} from 'incremental-dom'
import { isIterable, paramCase, SPECT_CLASS } from './util'


attributes.class = applyAttr
attributes.is = (target, name, value) => {
  if (target.setAttribute) applyAttr(target, name, value)
  return applyProp(target, name, value)
}
attributes[symbols.default] = applyProp

notifications.nodesDeleted = function (nodes) {
  nodes.forEach((node) => node[_spect] && node[_spect].dispose())
};

const _target = Symbol.for('spect.target')
const _instance = Symbol.for('spect.instance')
const _spect = Symbol.for('spect')


export default function html(...args) {
  let el = this[_target] || this

  // tpl string: html`<a>`
  let vdom
  if (args[0].raw) {
    vdom = htm.call(h, ...args)
  }</a>
github tailhook / khufu / khufu-runtime / src / index.js View on Github external
function set_global_state(params) {
    var old = {
        stores: attributes.__stores,
        applyAttr: attributes[symbols.default],
        deleted: notifications.nodesDeleted,
    }
    attributes.__stores = store_handler(params)
    attributes[symbols.default] = applyAttribute
    notifications.nodesDeleted = cleanup_stores
    return old
}
github tailhook / khufu / khufu-runtime / src / index.js View on Github external
function clean_global_state(old) {
    notifications.nodesDeleted = old.deleted
    attributes[symbols.default] = old.applyAttr
    attributes.__stores = old.stores
}
github ferrugemjs / library / src / core / component-factory.ts View on Github external
import { patch, notifications, attributes } from 'incremental-dom';
import inst_watched from './nodes-watched';
import { detacheNode, attacheNode } from './nodes-action';

notifications.nodesDeleted = function (nodes: HTMLDivElement[]) {
  nodes.forEach(detacheNode);
};

notifications.nodesCreated = function (nodes: HTMLDivElement[]) {
  nodes.forEach(attacheNode);
};
attributes.value = function (el: any, name: string, value: any) {
  el.value = value === null || typeof (value) === 'undefined' ? '' : value;
};
attributes.checked = function (el: any, name: string, value: any) {
  el.checked = !!value;
};

export default (p_module:any , props_inst:{[key:string]:any}, {key_id,is}:{is:string, key_id:string}) => {
  
  return {