pas2js/demo/modules/flat-units/square.pp
Michaël Van Canneyt 0c4ac1b113 * Module demos
2021-09-11 14:59:41 +02:00

29 lines
760 B
ObjectPascal

{$linklib ./modules/square.js square}
{$mode objfpc}
{$modeswitch externalclass}
unit square;
interface
uses js, web;
Type
TDrawResult = class external name 'Object' (TJSObject)
length,x,y : Integer;
color : string;
end;
// Square API
var
name : string; external name 'square.name';
function randomsquare(aCtx : TJSCanvasRenderingContext2D) : TDrawResult; external name 'square.default';
function draw(aCtx : TJSCanvasRenderingContext2D; alength,x,y : Integer; color : string) : TDrawResult; external name 'square.draw';
procedure reportArea(length : Integer; ListID : String); external name 'square.reportArea';
procedure reportPerimeter(length : Integer; ListID : String); external name 'square.reportPerimeter';
implementation
end.