Skip to content

Commit 0fb41a8

Browse files
authored
Merge pull request #3 from seriussoft/seriussoft-patch-2
Create switchmanager.ts [Add Namespaces] Merging...
2 parents c51a69f + ad0a6e3 commit 0fb41a8

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

classes/switchmanager.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace switchblock {
2+
class SwitchManager {
3+
private switches: { [name: string]: SwitchContext } = {};
4+
5+
create(name: string): SwitchContext {
6+
const ctx = new SwitchContext();
7+
this.switches[name] = ctx;
8+
return ctx;
9+
}
10+
11+
get(name: string): SwitchContext {
12+
return this.switches[name];
13+
}
14+
15+
debug(name: string): void {
16+
const ctx = this.switches[name];
17+
console.log(`Switch "${name}" has ${ctx.caseCount()} cases`);
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)