fix: minor refactor to reduce code size
This commit is contained in:
parent
15bca2197f
commit
ff1326151b
|
@ -2,6 +2,7 @@ import { getFromMap, parseTemplate, toString } from './utils.js'
|
|||
|
||||
const parseCache = new WeakMap()
|
||||
const domInstancesCache = new WeakMap()
|
||||
// This needs to be a symbol because it needs to be different from any possible output of a key function
|
||||
const unkeyedSymbol = Symbol('un-keyed')
|
||||
|
||||
// for debugging
|
||||
|
@ -201,8 +202,10 @@ function parse (tokens) {
|
|||
|
||||
bindings.push(binding)
|
||||
|
||||
// add a placeholder comment that we can find later
|
||||
htmlString += (!withinTag && !withinAttribute) ? `<!--${bindings.length - 1}-->` : ''
|
||||
if (!withinTag && !withinAttribute) {
|
||||
// add a placeholder comment that we can find later
|
||||
htmlString += `<!--${bindings.length - 1}-->`
|
||||
}
|
||||
}
|
||||
|
||||
const template = parseTemplate(htmlString)
|
||||
|
|
|
@ -38,7 +38,6 @@ export function createState (abortSignal) {
|
|||
|
||||
const state = new Proxy({}, {
|
||||
get (target, prop) {
|
||||
// console.log('reactivity: get', prop)
|
||||
if (currentObserver) {
|
||||
let observers = propsToObservers.get(prop)
|
||||
if (!observers) {
|
||||
|
@ -50,7 +49,6 @@ export function createState (abortSignal) {
|
|||
return target[prop]
|
||||
},
|
||||
set (target, prop, newValue) {
|
||||
// console.log('reactivity: set', prop, newValue)
|
||||
target[prop] = newValue
|
||||
const observers = propsToObservers.get(prop)
|
||||
if (observers) {
|
||||
|
|
Loading…
Reference in New Issue