This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ProceduralStopWatch { | |
| public startTime; | |
| public stopTime; | |
| getElapsedTime = () => this.startMsTime - this.stopMsTime | |
| } | |
| // example | |
| const stopWatch = new ProceduralStopWatch(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Gear { | |
| constructor( | |
| readonly chainring: number, | |
| readonly cog: number, | |
| readonly rim: number, | |
| readonly tire: number | |
| ) {} | |
| get ratio() { | |
| return this.chainring / this.cog; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Gear { | |
| constructor( | |
| readonly chainring: number, | |
| readonly cog: number, | |
| readonly wheel: { diameter: number } | |
| ) {} | |
| get ratio() { | |
| return this.chainring / this.cog; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Gear { | |
| readonly wheel; | |
| constructor( | |
| readonly chainring: number, | |
| readonly cog: number, | |
| rim : number, | |
| tire: number | |
| ) { | |
| this.wheel = new Wheel(rim, tire); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Gear { | |
| private _wheel: Wheel; | |
| constructor( | |
| readonly chainring: number, | |
| readonly cog: number, | |
| readonly rim: number, | |
| readonly tire: number | |
| ) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Gear { | |
| private _wheel: Wheel; | |
| constructor( | |
| readonly chainring: number, | |
| readonly cog: number, | |
| readonly rim: number, | |
| readonly tire: number | |
| ) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Gear { | |
| private _wheel: Wheel; | |
| constructor( | |
| readonly chainring: number, | |
| readonly cog: number, | |
| readonly rim: number, | |
| readonly tire: number | |
| ) {} |
OlderNewer