Skip to content

Commit 12ea94f

Browse files
authored
Fixing as per suggestions
1 parent 1e0e11e commit 12ea94f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/strands/strands_api.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ function getBuiltinGlobalNode(strandsContext, name) {
7979
if (!spec) return null;
8080

8181
const uniformName = `_p5_global_${name}`;
82+
const instance = strandsContext.renderer?._pInst || strandsContext.p5?.instance;
8283

8384
const node = getOrCreateUniformNode(
8485
strandsContext,
8586
uniformName,
8687
spec.typeInfo,
8788
() => {
88-
const p5Instance = strandsContext.renderer?._pInst || strandsContext.p5?.instance;
89-
return p5Instance ? spec.get(p5Instance) : undefined;
89+
return instance ? spec.get(instance) : undefined;
9090
}
9191
);
9292

@@ -321,13 +321,13 @@ export function initGlobalStrandsAPI(p5, fn, strandsContext) {
321321
if (!strandsContext.active) {
322322
return originalMillis.apply(this, args);
323323
}
324+
const instance = strandsContext.renderer?._pInst || strandsContext.p5?.instance;
324325
return getOrCreateUniformNode(
325326
strandsContext,
326327
'_p5_global_millis',
327328
DataType.float1,
328329
() => {
329-
const p5Instance = strandsContext.renderer?._pInst || strandsContext.p5?.instance;
330-
return p5Instance ? p5Instance.millis() : undefined;
330+
return instance ? instance.millis() : undefined;
331331
}
332332
);
333333
};

0 commit comments

Comments
 (0)