forked from microsoft/napajs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzone.ts
48 lines (38 loc) · 1.63 KB
/
zone.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import * as zone from './zone/zone';
import * as impl from './zone/zone-impl';
import * as platform from './runtime/platform';
let binding = require('./binding');
// This variable is either defined by napa runtime, or not defined (hence node runtime)
declare var __in_napa: boolean;
/// <summary> Creates a new zone. </summary>
/// <summary> A unique id to identify the zone. </summary>
/// <param name="settings"> The settings of the new zone. </param>
export function create(id: string, settings: zone.ZoneSettings = zone.DEFAULT_SETTINGS) : zone.Zone {
platform.initialize();
return new impl.ZoneImpl(binding.createZone(id, settings));
}
/// <summary> Returns the zone associated with the provided id. </summary>
export function get(id: string) : zone.Zone {
platform.initialize();
return new impl.ZoneImpl(binding.getZone(id));
}
/// TODO: add function getOrCreate(id: string, settings: zone.ZoneSettings): Zone.
/// <summary> Define a getter property 'current' to retrieve the current zone. </summary>
export declare let current: zone.Zone;
Object.defineProperty(exports, "current", {
get: function () : zone.Zone {
platform.initialize();
return new impl.ZoneImpl(binding.getCurrentZone());
}
});
/// <summary> Define a getter property 'node' to retrieve node zone. </summary>
export declare let node: zone.Zone;
Object.defineProperty(exports, "node", {
get: function () : zone.Zone {
platform.initialize();
return new impl.ZoneImpl(binding.getZone('node'));
}
});
export * from './zone/zone';