Implement list (#924)

* Add eslint support for Maki any

* Implement all of List
This commit is contained in:
Jordan Eldredge 2019-09-19 07:15:25 -07:00 committed by GitHub
parent a17489de93
commit eafca2f182
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 25 deletions

View file

@ -41,6 +41,10 @@ const TYPE_MAP = {
typeScriptName: "TSNumberKeyword",
stringRepresentation: "number",
},
any: {
typeScriptName: "TSAnyKeyword",
stringRepresentation: "any",
},
};
module.exports = {

View file

@ -192,12 +192,6 @@ Layout.beforeredock
Layout.redock
Layout.istransparencysafe
Layout.islayoutanimationsafe
List.additem
List.removeitem
List.enumitem
List.finditem
List.getnumitems
List.removeall
Layer.setregion
Layer.setregionfrommap
Layer.fx_oninit

View file

@ -1,7 +1,13 @@
import MakiObject from "./MakiObject";
import { unimplementedWarning } from "../utils";
class List extends MakiObject {
_list: Array<any>;
constructor(node, parent, annotations, store) {
super(node, parent, annotations, store);
this._list = [];
}
/**
* getclassname()
*
@ -12,34 +18,28 @@ class List extends MakiObject {
return "List";
}
additem(_object) {
unimplementedWarning("additem");
return;
additem(object: any): void {
this._list.push(object);
}
removeitem(pos: number) {
unimplementedWarning("removeitem");
return;
removeitem(pos: number): void {
this._list.splice(pos, 1);
}
enumitem(pos: number) {
unimplementedWarning("enumitem");
return;
enumitem(pos: number): any {
return this._list[pos];
}
finditem(_object) {
unimplementedWarning("finditem");
return;
finditem(obj: any): number {
return this._list.indexOf(obj);
}
getnumitems() {
unimplementedWarning("getnumitems");
return;
getnumitems(): number {
return this._list.length;
}
removeall() {
unimplementedWarning("removeall");
return;
removeall(): void {
this._list = [];
}
}