mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2025-01-07 13:43:03 +03:00
30 lines
390 B
JavaScript
30 lines
390 B
JavaScript
global.Shape = class Shape {
|
|
constructor(kind) {
|
|
this.kind = kind;
|
|
}
|
|
|
|
static triangle() {
|
|
return new Shape('triangle');
|
|
}
|
|
|
|
isSquare() {
|
|
return this.kind === 'square';
|
|
}
|
|
|
|
isCircle() {
|
|
return this.kind === 'circle';
|
|
}
|
|
|
|
getShape() {
|
|
return this.kind;
|
|
}
|
|
|
|
get shapeTypeNone() {
|
|
return null;
|
|
}
|
|
|
|
get shapeTypeSome() {
|
|
return this.kind;
|
|
}
|
|
};
|