mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-18 07:11:56 +03:00
22 lines
293 B
JavaScript
22 lines
293 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;
|
||
|
}
|
||
|
};
|