17 lines
470 B
TypeScript
Raw Normal View History

2019-03-26 23:35:08 +01:00
/// <reference path="./collector/index.d.ts" />
2019-03-13 22:35:47 +01:00
/** Garbage collector interface. */
export namespace gc {
2019-03-14 04:33:58 +01:00
/** Whether the garbage collector interface is implemented. */
2019-03-14 06:09:49 +01:00
// @ts-ignore: decorator
@lazy
2019-03-26 23:35:08 +01:00
export const IMPLEMENTED: bool = isDefined(__ref_collect);
2019-03-13 22:35:47 +01:00
/** Performs a full garbage collection cycle. */
2019-03-14 04:33:58 +01:00
export function collect(): void {
2019-03-26 23:35:08 +01:00
if (isDefined(__ref_collect)) __ref_collect();
2019-03-14 04:33:58 +01:00
else WARNING("missing implementation: gc.collect");
2019-03-13 22:35:47 +01:00
}
}