Skip to content

Commit 2390972

Browse files
Techbot121Meta Construct
authored andcommitted
better variable naming
1 parent d4dab35 commit 2390972

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

app/Container.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,35 @@ export class Container {
3535
}
3636
}
3737

38-
async getService<Name extends string>(
39-
type: Name,
38+
async getService<ServiceName extends string>(
39+
service: ServiceName,
4040
timeoutMs = 30000
41-
): Promise<ServiceMap[Name]> {
42-
if (this.services[type]) {
43-
return this.services[type];
41+
): Promise<ServiceMap[ServiceName]> {
42+
if (this.services[service]) {
43+
return this.services[service];
4444
}
4545

4646
// Create or return existing promise for this service
47-
if (!this.pendingServices.has(type)) {
47+
if (!this.pendingServices.has(service)) {
4848
this.pendingServices.set(
49-
type,
49+
service,
5050
new Promise((resolve, reject) => {
5151
const timeoutId = setTimeout(() => {
52-
this.pendingServices.delete(type);
53-
reject(new Error(`Timeout waiting for service: ${type}`));
52+
this.pendingServices.delete(service);
53+
reject(new Error(`Timeout waiting for service: ${service}`));
5454
}, timeoutMs);
5555

5656
const checkInterval = setInterval(() => {
57-
if (this.services[type]) {
57+
if (this.services[service]) {
5858
clearTimeout(timeoutId);
5959
clearInterval(checkInterval);
60-
resolve(this.services[type]);
60+
resolve(this.services[service]);
6161
}
6262
}, 100);
6363
})
6464
);
6565
}
6666

67-
return this.pendingServices.get(type) as Promise<ServiceMap[Name]>;
67+
return this.pendingServices.get(service) as Promise<ServiceMap[ServiceName]>;
6868
}
6969
}

0 commit comments

Comments
 (0)