skia2/experimental/tskit/npm_build/example.html
Kevin Lubick 38320680cb [canvaskit] Proof of Concept for Typescript-build structure
This CL demonstrates the following
 - Interface code written in TS
 - Having support for modular builds (e.g. making Paragraph
   optional)
 - Avoiding monolithic interface files
 - Using eslint to enforce style and avoid errors.
 - Working debug and release build (using example.html)

Many of these files would be generated via a tool (that
has not been written yet).

go/ts-canvaskit

Change-Id: Ibe9a214d5897b09920cef01f6e95302f3cf30d5c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392297
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-04-09 19:01:49 +00:00

31 lines
897 B
HTML

<!DOCTYPE html>
<title>TSKit (CanvasKit with Typescript)</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="/npm_build/bin/tskit.js"></script>
<script type="text/javascript" charset="utf-8">
async function run() {
const tsKit = InitTSKit({locateFile: (file) => '/npm_build/bin/' + file});
const TSK = await tsKit;
TSK.sayHello(8, 4);
TSK.publicFunction("vanilla");
const sm = new TSK.Something("sentinel");
sm.setName("double_vision");
console.log(sm.getName());
sm.delete();
if (TSK.publicExtension) {
console.log("extension", TSK.publicExtension([0, 0, 10, 10, 10, 10, 20, 20]));
TSK.withObject({alpha: 7, beta: "foo"});
} else {
console.log("no extension")
}
}
run();
</script>