Skip to content

Commit f43f279

Browse files
committed
@InjectToP5js call signature
1 parent 2f6f903 commit f43f279

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

@types/decorators/p5jsClassInjection.d.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Class } from "../../typings/types";
22
export default InjectToP5js;
3-
declare function InjectToP5js(c: Class): void;
3+
declare function InjectToP5js(targetClass: Class): void;
44
declare function InjectToP5js(isP5ParamLast?: boolean, // defaults to falsy
55
createPrefix?: string, // defaults to "create" + classname
66
scriptTagAttrName?: string): ClassDecorator;

@types/decorators/p5jsClassInjection.d.mts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

@types/utils/checkGlobalMode.d.mts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/decorators/p5jsClassInjection.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function InjectToP5js(isP5ParamLast, createPrefix = CREATE, scriptTagAttrName =
1616
function () {
1717
return new c(this, ...arguments);
1818
};
19+
globalThis.p5?.prototype.registerMethod(INIT, applyInjections);
1920
function exposeClassGlobally() {
2021
name in globalThis || Object.defineProperty(globalThis, name, {
2122
value: c,
@@ -30,6 +31,5 @@ function InjectToP5js(isP5ParamLast, createPrefix = CREATE, scriptTagAttrName =
3031
...DescriptorsAllTrue
3132
});
3233
}
33-
globalThis.p5?.prototype.registerMethod(INIT, applyInjections);
3434
}
3535
}

dist/utils/checkGlobalMode.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// https://developer.Mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
12
export default function isGlobalMode() {
23
return typeof globalThis.setup == 'function' ||
34
typeof globalThis.draw == 'function';

src/decorators/p5jsClassInjection.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { AUTO, CREATE, INIT, DescriptorsAllTrue } from "../base/globals.mjs";
88

99
export default InjectToP5js;
1010

11-
function InjectToP5js(c: Class): void; // isP5ParamLast is truthy
11+
function InjectToP5js(targetClass: Class): void; // isP5ParamLast is truthy
1212

1313
function InjectToP5js(
1414
isP5ParamLast?: boolean, // defaults to falsy
@@ -39,6 +39,8 @@ function InjectToP5js(
3939
}
4040
;
4141

42+
globalThis.p5?.prototype.registerMethod(INIT, applyInjections);
43+
4244
function exposeClassGlobally() {
4345
name in globalThis || Object.defineProperty(globalThis, name, {
4446
value: c,
@@ -54,7 +56,5 @@ function InjectToP5js(
5456
...DescriptorsAllTrue
5557
});
5658
}
57-
58-
globalThis.p5?.prototype.registerMethod(INIT, applyInjections);
5959
}
6060
}

0 commit comments

Comments
 (0)