More typescript stuff

This commit is contained in:
qfx 2020-02-19 23:09:18 +02:00
parent 69a0e74619
commit 16cbc612a5
5 changed files with 12 additions and 15 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
local_conf.lua

11
core/input.d.ts vendored
View File

@ -3,13 +3,4 @@ interface Subscription{
off():void;
}
export enum inputType{
clicked = "clicked",
keypressed = "keypressed",
hover = "hover",
mousepressed = "mousepressed",
mousereleased = "mousereleased",
dragged = "dragged"
}
export function input(it:inputType,cb:(x?:number,y?:number)=>void,doff?:boolean,x?:number,y?:number,w?:number,h?:number): Subscription;
export default function input(it:string,cb:(x?:number,y?:number)=>void,doff?:boolean,x?:number,y?:number,w?:number,h?:number): Subscription;

View File

@ -506,4 +506,6 @@ function input.eventHandlers.mousemoved(x, y, dx, dy)
return captured
end
--Typescript
input.input = input
return input

View File

@ -21,12 +21,13 @@ interface HeliumElement{
view: view;
state: state;
parameters: parameters;
draw(x:number,y:number): null;
undraw(): null;
draw(this,x:number,y:number): null;
undraw(this): null;
}
declare function HeliumLoader(filepath:string):(params:parameters, w:number, h:number)=>HeliumElement;
export module helium{
export let input: typeof import("./core/input") ;
export let input: typeof import("./helium/core/input") ;
}
export function helium<T>(chunk:(params:T,state:state,view:view)=>()=>void):(params:T, w:number, h:number)=>HeliumElement;

View File

@ -5,7 +5,7 @@
----------------------------------------------------]]
local path = ...
local helium = require(path..".dummy")
helium.conf = require(path..".conf")
helium.conf = require(path..".local_conf") or require(path..".conf")
helium.utils = require(path..".utils")
helium.element = require(path..".core.element")
helium.input = require(path..".core.input")
@ -124,4 +124,6 @@ if helium.conf.AUTO_RUN then
end
end
--Typescript
helium.helium = helium
return helium