module1.ts 347 B

123456789101112131415161718
  1. import { ICounter } from "../common/interfaces";
  2. export class CommonJsCounter implements ICounter {
  3. constructor(private _value:number = 0) {
  4. }
  5. public get value(): string {
  6. return `commonjs ${this._value}`;
  7. }
  8. public incr(): void {
  9. ++this._value;
  10. }
  11. public decr(): void {
  12. --this._value;
  13. }
  14. }