watcher

Watch for added and removed elements and changes to attributes or text content

このスクリプトは単体で利用できません。右のようなメタデータを含むスクリプトから、ライブラリとして読み込まれます: // @require https://update.greasyfork.org/scripts/370259/994538/watcher.js

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
作者
spiralx
バージョン
0.0.2
作成日
2018/07/13
更新日
2021/12/04
ライセンス
不明

watcher

Watch a page's DOM for added and removed elements and changes to attributes or text content.


const watcher = new Watcher()

const watch = watcher.add('a[href]', result => {
  console.group(`Added ${result.added.length} links, removed ${result.removed.length} links`)
  for (const a of result.added) {
    console.log(`Added: %o`, a)
  }
  for (const a of result.removed) {
    console.log(`Removed: %o`, a)
  }
  console.groupEnd()
})

watcher.start()