Skip to content

Commit

Permalink
Add support for stat and modified time on sys
Browse files Browse the repository at this point in the history
  • Loading branch information
mhegazy committed Feb 12, 2015
1 parent e4128af commit 9735b74
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/compiler/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module ts {
readDirectory(path: string, extension?: string): string[];
getMemoryUsage? (): number;
exit(exitCode?: number): void;
getModififedTime? (fileName: string): Date;
stat? (fileName: string, callback?: (err: any, stats: any) => any): void;

This comment has been minimized.

Copy link
@mihailik

mihailik Feb 12, 2015

Contributor

If this goes in (I assume you're doing that hackathon everybody talks about), it's a good idea to specify properties on stats. Otherwise mocking/reimplementing of System over non-node host would be painful.

}

export interface FileWatcher {
Expand Down Expand Up @@ -303,6 +305,13 @@ module ts {
},
exit(exitCode?: number): void {
process.exit(exitCode);
},
getModififedTime(fileName: string): Date {
var stats = _fs.statSync(fileName);
return stats.mtime;
},
stat(fileName: string, callback?: (err: any, stats: any) => any) {
_fs.stat(fileName, callback);
}
};
}
Expand Down

0 comments on commit 9735b74

Please sign in to comment.