simplify API

This commit is contained in:
Johannes Rieken
2016-09-07 10:06:03 +02:00
parent b725c7120f
commit 21820b36c1
5 changed files with 36 additions and 54 deletions

View File

@@ -265,6 +265,20 @@ export abstract class ExtHostFileSystemEventServiceShape {
$onFileEvent(events: FileSystemEvents) { throw ni(); }
}
export interface ObjectIdentifier {
$ident: number;
}
export namespace ObjectIdentifier {
export function mixin<T>(obj: T, id: number): T & ObjectIdentifier {
Object.defineProperty(obj, '$ident', { value: id, enumerable: true });
return <T & ObjectIdentifier>obj;
}
export function get(obj: any): number {
return obj['$ident'];
}
}
export abstract class ExtHostHeapMonitorShape {
$onGarbageCollection(ids: number[]): void { throw ni(); }
}