-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathidea.ts
More file actions
45 lines (42 loc) · 829 Bytes
/
idea.ts
File metadata and controls
45 lines (42 loc) · 829 Bytes
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
import { unsubscribe } from "diagnostics_channel"
import { subscriber } from "./app"
Isubsciber //--> should be an abstact class
{
handle(event)
{
//virtual fuction
}
subscribe(publisher)
{
publisher.subscribe(this.machienId())
}
unsubsciber(publisher)
{
publisher.unsubscribe(this.machienid())
}
machineid()
{
return this.machineid:
}
Machine machine;
}
IPublishSubscriber
{
subsciber(target)
{
this.subscibers.push(target);
}
unsubscribe(machineId)
{
this.subscibers.splice(this.subscibers.find(m -> m.machineId() == machineId), 1)
}
Machine subscriber = [];
}
MachineRefilsubsciber extends ISubsciber
{
handle()
{
//refill he machine
this.machine.stockLevel = 10;
}
}