chore(lib): make assignments more readable
This commit is contained in:
parent
6c596a4a5c
commit
934b25de08
2 changed files with 5 additions and 20 deletions
|
|
@ -52,10 +52,7 @@ export function onModuleInitialized(
|
|||
callback: ModuleInitializedCallback,
|
||||
) {
|
||||
let set = sInitialize.get(id)
|
||||
if (!set) {
|
||||
set = new Set()
|
||||
sInitialize.set(id, set)
|
||||
}
|
||||
if (!set) sInitialize.set(id, (set = new Set()))
|
||||
|
||||
set.add(callback)
|
||||
return () => {
|
||||
|
|
@ -115,10 +112,7 @@ export function onModuleFirstRequired(
|
|||
callback: ModuleFirstRequiredCallback,
|
||||
) {
|
||||
let set = sRequire.get(id)
|
||||
if (!set) {
|
||||
set = new Set()
|
||||
sRequire.set(id, set)
|
||||
}
|
||||
if (!set) sRequire.set(id, (set = new Set()))
|
||||
|
||||
set.add(callback)
|
||||
return () => {
|
||||
|
|
|
|||
|
|
@ -37,10 +37,7 @@ export function afterJSX<E extends ElementType>(
|
|||
patch: AfterJSXCallback<E>,
|
||||
) {
|
||||
let patches = jPatches.get(type)
|
||||
if (!patches) {
|
||||
patches = {}
|
||||
jPatches.set(type, patches)
|
||||
}
|
||||
if (!patches) jPatches.set(type, (patches = {}))
|
||||
|
||||
const set = (patches.after ??= new Set())
|
||||
|
||||
|
|
@ -64,10 +61,7 @@ export function beforeJSX<E extends ElementType>(
|
|||
patch: BeforeJSXCallback<E>,
|
||||
) {
|
||||
let patches = jPatches.get(type)
|
||||
if (!patches) {
|
||||
patches = {}
|
||||
jPatches.set(type, patches)
|
||||
}
|
||||
if (!patches) jPatches.set(type, (patches = {}))
|
||||
|
||||
const set = (patches.before ??= new Set())
|
||||
|
||||
|
|
@ -91,10 +85,7 @@ export function insteadJSX<E extends ElementType>(
|
|||
patch: InsteadJSXCallback<E>,
|
||||
) {
|
||||
let patches = jPatches.get(type)
|
||||
if (!patches) {
|
||||
patches = {}
|
||||
jPatches.set(type, patches)
|
||||
}
|
||||
if (!patches) jPatches.set(type, (patches = {}))
|
||||
|
||||
const set = (patches.instead ??= new Set())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue