-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from playcanvas/typescript
TypeScript Support
- Loading branch information
Showing
12 changed files
with
507 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// eslint-disable-next-line | ||
import { Script, Asset } from 'playcanvas'; | ||
|
||
class Example extends Script { | ||
/** | ||
* @attribute | ||
* @resource nothing | ||
*/ | ||
a: Asset; | ||
|
||
/** | ||
* @attribute | ||
* @resource 1 | ||
*/ | ||
b : Asset; | ||
|
||
/** | ||
* @attribute | ||
* @resource | ||
*/ | ||
c : Asset; | ||
} | ||
|
||
export { Example }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// eslint-disable-next-line | ||
import { Script, Asset } from 'playcanvas'; | ||
|
||
class Example extends Script { | ||
/** @attribute */ | ||
a : Asset; | ||
|
||
/** | ||
* @attribute | ||
* @resource texture | ||
*/ | ||
b : Asset; | ||
|
||
/** | ||
* @attribute | ||
* @resource container | ||
*/ | ||
c : Asset[]; | ||
} | ||
|
||
export { Example }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Script, Vec3 } from 'playcanvas'; | ||
|
||
enum NumberEnum { | ||
A = 13, | ||
B = 14, | ||
C = 23 | ||
}; | ||
|
||
enum StringEnum { | ||
A = 'a', | ||
B = 'b', | ||
C = 'c' | ||
}; | ||
|
||
enum NumberNumberEnum { | ||
A = NumberEnum.A, | ||
B = NumberEnum.B, | ||
C = NumberEnum.C | ||
}; | ||
|
||
class Example extends Script { | ||
/** | ||
* @attribute | ||
*/ | ||
e : NumberEnum = NumberEnum.A; | ||
|
||
/** | ||
* @attribute | ||
*/ | ||
f : NumberEnum = 1; | ||
|
||
/** | ||
* @attribute | ||
* @size 2 | ||
*/ | ||
g : NumberEnum[]; | ||
|
||
/** | ||
* @attribute | ||
*/ | ||
h : StringEnum; | ||
|
||
/** | ||
* @attribute | ||
*/ | ||
i : NumberNumberEnum = 2; | ||
} | ||
|
||
export { Example }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Script, Vec3 } from 'playcanvas'; | ||
|
||
interface Folder { | ||
/** | ||
* @attribute | ||
*/ | ||
a: boolean; | ||
|
||
/** | ||
* @attribute | ||
* @default 10 | ||
*/ | ||
b: number; | ||
|
||
/** | ||
* @attribute | ||
* @default hello | ||
*/ | ||
c : string; | ||
|
||
/** | ||
* @attribute | ||
*/ | ||
d : Vec3[]; | ||
} | ||
|
||
interface NestedFolder { | ||
/** | ||
* @attribute | ||
*/ | ||
x : Folder; | ||
} | ||
|
||
/** | ||
* @interface | ||
*/ | ||
class Example extends Script { | ||
/** | ||
* @attribute | ||
*/ | ||
f : Folder; | ||
|
||
/** | ||
* @attribute | ||
* @size 2 | ||
*/ | ||
g : Folder[]; | ||
|
||
/** | ||
* @attribute | ||
*/ | ||
h : NestedFolder; | ||
|
||
/** | ||
* @attribute | ||
*/ | ||
i = { a: true, b: 10, c: 'hello', d: [new Vec3(1, 2, 3)] }; | ||
|
||
/** | ||
* @attribute | ||
*/ | ||
l : { x: number, y: number }; | ||
|
||
/** | ||
* @attribute | ||
*/ | ||
m : Example; | ||
|
||
n = 10; | ||
} | ||
|
||
export { Example }; |
Oops, something went wrong.