-
Notifications
You must be signed in to change notification settings - Fork 0
9. TypeScript
CookieShade edited this page Aug 7, 2016
·
3 revisions
The library comes with a TypeScript declaration file, BETA.d.ts
which has all the neccessary type information the compiler needs to be able to reference the library.
The declaration file defines all the normal functions of the library, and a few extra types:
-
BETA.Color
- for BETA.js color objects -
BETA.Vector
- for 2D vectors -
BETA.CanvasRenderer
- for canvas renderer instances -
BETA.CanvasStyle
- the type of canvas renderer functions'color
parameters -
BETA.ButtonEventHandler
- type of a button input handling callback
Include this comment in your TypeScript code:
/// <reference path="path/to/BETA.d.ts" />
Now the compiler knows about the library. Make sure to actually include BETA.js in the output file as well, or you'll just get drowned in runtime errors.