MCPcopy
hub / github.com/phaserjs/phaser / first

Function first

src/display/canvas/CanvasPool.js:142–162  ·  view source on GitHub ↗
(canvasType)

Source from the content-addressed store, hash-verified

140 * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases.
141 */
142 var first = function (canvasType)
143 {
144 if (canvasType === undefined) { canvasType = CONST.CANVAS; }
145
146 if (canvasType === CONST.WEBGL)
147 {
148 return null;
149 }
150
151 for (var i = 0; i < pool.length; i++)
152 {
153 var container = pool[i];
154
155 if (!container.parent && container.type === canvasType)
156 {
157 return container;
158 }
159 }
160
161 return null;
162 };
163
164 /**
165 * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use.

Callers 1

createFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…