Compare commits
2 commits
12daec85e6
...
74de53874b
Author | SHA1 | Date | |
---|---|---|---|
74de53874b | |||
21e5bdbba4 |
2 changed files with 5 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
||||||
"version": "1.7.0",
|
"version": "1.7.0",
|
||||||
"author": "darkwiiplayer",
|
"author": "darkwiiplayer",
|
||||||
"license": "Unlicense",
|
"license": "Unlicense",
|
||||||
"main": "skooma.js",
|
"main": "render.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -134,6 +134,9 @@ class ReplacedEvent extends Event {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {WeakMap<Text|Element,Text|Element>} */
|
||||||
|
export const newer = new WeakMap()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Observable} observable
|
* @param {Observable} observable
|
||||||
* @return {Element|Text}
|
* @return {Element|Text}
|
||||||
|
@ -147,6 +150,7 @@ export const reactiveElement = observable => {
|
||||||
const element = ref.deref()
|
const element = ref.deref()
|
||||||
if (element.dispatchEvent(new ReplaceEvent(next)))
|
if (element.dispatchEvent(new ReplaceEvent(next)))
|
||||||
element.replaceWith(next)
|
element.replaceWith(next)
|
||||||
|
newer.set(this, next)
|
||||||
element.dispatchEvent(new ReplacedEvent(next))
|
element.dispatchEvent(new ReplacedEvent(next))
|
||||||
}, {once: true})
|
}, {once: true})
|
||||||
return element
|
return element
|
Loading…
Reference in a new issue