@thigasdevelopment/luam 0.2.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,40 +0,0 @@
1
- class Listener {
2
- core: any = nil
3
- event: string = ''
4
- element: any = nil
5
- binding: any = nil
6
-
7
- constructor(core: any) {
8
- self.core = core
9
- self.binding = nil
10
- }
11
-
12
- target(): any {
13
- if self.element == nil then
14
- return root
15
- end
16
-
17
- return self.element
18
- }
19
-
20
- handle(...): void {
21
- }
22
-
23
- register(): boolean {
24
- if self.event == '' then
25
- return false
26
- end
27
-
28
- self.binding = new Event(self.event, self:target(), bind(self.handle, self))
29
-
30
- return self.binding:attach()
31
- }
32
-
33
- unregister(): boolean {
34
- if self.binding == nil then
35
- return false
36
- end
37
-
38
- return self.binding:detach()
39
- }
40
- }
@@ -1,73 +0,0 @@
1
- class Loader {
2
- core: any = nil
3
-
4
- constructor(core: any) {
5
- self.core = core
6
- }
7
-
8
- inherits(definition: any, baseName: string): boolean {
9
- local current: any = definition
10
-
11
- while current ~= nil do
12
- local parent: any = rawget(current, '__super')
13
-
14
- if parent == nil then
15
- return false
16
- end
17
-
18
- if rawget(parent, '__name') == baseName then
19
- return true
20
- end
21
-
22
- current = parent
23
- end
24
-
25
- return false
26
- }
27
-
28
- subclasses(baseName: string): string[] {
29
- local found: string[] = {}
30
- local definitions: table = getClasses()
31
-
32
- for name, definition in pairs(definitions) do
33
- if self:inherits(definition, baseName) then
34
- table.insert(found, name)
35
- end
36
- end
37
-
38
- table.sort(found)
39
-
40
- return found
41
- }
42
-
43
- instantiate(baseName: string): any {
44
- local created: any = {}
45
- local names: string[] = self:subclasses(baseName)
46
-
47
- for index = 1, #names do
48
- table.insert(created, new(names[index])(self.core))
49
- end
50
-
51
- return created
52
- }
53
-
54
- loadListeners(): any {
55
- local listeners: any = self:instantiate('Listener')
56
-
57
- for index = 1, #listeners do
58
- listeners[index]:register()
59
- end
60
-
61
- return listeners
62
- }
63
-
64
- loadCommands(): any {
65
- local commands: any = self:instantiate('Command')
66
-
67
- for index = 1, #commands do
68
- commands[index]:register()
69
- end
70
-
71
- return commands
72
- }
73
- }
@@ -1,27 +0,0 @@
1
- class ThreadPool {
2
- pool: any = nil
3
-
4
- constructor(style: string, priority: string) {
5
- self.pool = Threads.new(style, priority)
6
- }
7
-
8
- add(task: any): number {
9
- return self.pool:add(task, {})
10
- }
11
-
12
- remove(id: number): boolean {
13
- return self.pool:remove(id)
14
- }
15
-
16
- clear(): boolean {
17
- return self.pool:clear()
18
- }
19
-
20
- priority(): string {
21
- return self.pool:getPriority()
22
- }
23
-
24
- setPriority(priority: string): boolean {
25
- return self.pool:setPriority(priority)
26
- }
27
- }