MCPcopy Index your code
hub / github.com/effector/effector / launch

Function launch

src/effector/kernel.ts:237–463  ·  view source on GitHub ↗
(unit: any, payload?: any, upsert?: boolean)

Source from the content-addressed store, hash-verified

235}): void
236export function launch(unit: NodeUnit, payload?: any, upsert?: boolean): void
237export function launch(unit: any, payload?: any, upsert?: boolean) {
238 let pageForLaunch = currentPage
239 let stackForLaunch = null
240 let forkPageForLaunch = forkPage
241 let meta: Record<string, any> | undefined
242 if (unit.target) {
243 payload = unit.params
244 upsert = unit.defer
245 meta = unit.meta
246 pageForLaunch = 'page' in unit ? unit.page : pageForLaunch
247 if (unit.stack) stackForLaunch = unit.stack
248 forkPageForLaunch = getForkPage(unit) || forkPageForLaunch
249 unit = unit.target
250 }
251 if (forkPageForLaunch && forkPage && forkPageForLaunch !== forkPage) {
252 forkPage = null
253 }
254 if (Array.isArray(unit)) {
255 for (let i = 0; i < unit.length; i++) {
256 pushFirstHeapItem(
257 'pure',
258 pageForLaunch,
259 getGraph(unit[i]),
260 stackForLaunch,
261 payload[i],
262 forkPageForLaunch,
263 meta,
264 )
265 }
266 } else {
267 pushFirstHeapItem(
268 'pure',
269 pageForLaunch,
270 getGraph(unit),
271 stackForLaunch,
272 payload,
273 forkPageForLaunch,
274 meta,
275 )
276 }
277 if (upsert && !isRoot) return
278 /** main execution code */
279 const lastStartedState = {
280 isRoot,
281 currentPage,
282 scope: forkPage,
283 isWatch,
284 isPure,
285 }
286 isRoot = false
287 let stop: boolean
288 let skip: boolean
289 let node: Node
290 let value: Layer | undefined
291 let page: Leaf | null
292 let reg: Record<string, StateRef> | undefined
293 kernelLoop: while ((value = deleteMin())) {
294 const {idx, stack, type} = value

Callers 15

createGateImplementationFunction · 0.90
useUnit.test.tsxFile · 0.90
launch.test.tsFile · 0.90
createGateImplementationFunction · 0.90
childLeafIteratorFunction · 0.90
runOpFunction · 0.90
fnFunction · 0.90
spawnFunction · 0.90
onChangeFunction · 0.90
fnFunction · 0.90
fnFunction · 0.90
fnFunction · 0.90

Calls 13

getForkPageFunction · 0.90
getGraphFunction · 0.90
getValueFunction · 0.90
readRefFunction · 0.90
forEachFunction · 0.90
pushFirstHeapItemFunction · 0.85
deleteMinFunction · 0.85
pushHeapFunction · 0.85
getPageForRefFunction · 0.85
initRefInScopeFunction · 0.85
getPageRefFunction · 0.85
tryRunFunction · 0.85

Tested by 2

nameClashCheckFunction · 0.72
nameClashCheckFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…