forked from frameable/el
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.js
37 lines (30 loc) · 829 Bytes
/
debug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { El } from './el.js'
class Debug extends El {
static {
const _notify = El.notify
const _dep = El.dep
El.notify = function(...args) {
console.log("el.notify", ...args)
return _notify(...args)
}
El.dep = function(path) {
if (!El._contextId) return true
try { var _prev = El.deps[path][El._contextId] } catch {}
const value = _dep(path);
try { var _new = El.deps[path][El._contextId] } catch {}
if (_prev != _new && _new) {
console.log("el.dep", El._contextId, path)
}
return value
}
}
constructor() {
super()
const _render = this.render.bind(this)
this.render = function(html) {
console.log('el.render', this.tagName, this.getAttribute('key'))
return _render(html)
}
}
}
export { Debug as El }