MCPcopy Create free account
hub / github.com/galacean/engine / forEach

Method forEach

packages/core/src/utils/DisorderedArray.ts:107–115  ·  view source on GitHub ↗

* Loop through all elements. * @param callbackFn - The callback function * @param swapFn - The swap function can process the element after the callback function, it will be called after end looping(`isLopping` = true)

(callbackFn: (element: T, index: number) => void, swapFn?: (element: T, index: number) => void)

Source from the content-addressed store, hash-verified

105 * @param swapFn - The swap function can process the element after the callback function, it will be called after end looping(`isLopping` = true)
106 */
107 forEach(callbackFn: (element: T, index: number) => void, swapFn?: (element: T, index: number) => void): void {
108 this._startLoop();
109 const elements = this._elements;
110 for (let i = 0, n = this.length; i < n; i++) {
111 const element = elements[i];
112 element && callbackFn(element, i);
113 }
114 this._endLoop(swapFn);
115 }
116
117 /**
118 * Loop through all elements and clean up the blank elements.

Callers 15

_removeColliderShapeMethod · 0.80
_fireEventMethod · 0.80
_vertexMainFunction · 0.80
_fragmentMainFunction · 0.80
getTrackedResultMethod · 0.80
_clearVAOMethod · 0.80
ApplyMixinsFunction · 0.80
callScriptOnUpdateMethod · 0.80
callAnimationUpdateMethod · 0.80
callRendererOnUpdateMethod · 0.80

Calls 2

_startLoopMethod · 0.95
_endLoopMethod · 0.95

Tested by 2

expectObjectToBeCloseToFunction · 0.64
createTestsForCategoryFunction · 0.64