@thigasdevelopment/luam 0.2.1 → 0.4.0
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.
- package/lua/async.lua +118 -118
- package/luam.mjs +239 -29
- package/package.json +1 -1
- package/template/README.md +0 -120
- package/template/config.lua +0 -14
- package/template/env +0 -11
- package/template/framework/bootstrap-client.luam +0 -9
- package/template/framework/bootstrap-server.luam +0 -9
- package/template/framework/command.luam +0 -54
- package/template/framework/core.luam +0 -58
- package/template/framework/event.luam +0 -39
- package/template/framework/listener.luam +0 -40
- package/template/framework/loader.luam +0 -73
- package/template/framework/thread-pool.luam +0 -27
- package/template/gitignore +0 -7
- package/template/src/client/commands/ping-command.luam +0 -8
- package/template/src/client/main.luam +0 -5
- package/template/src/server/commands/hello-command.luam +0 -9
- package/template/src/server/handlers/player-join-listener.luam +0 -9
- package/template/src/server/main.luam +0 -11
- package/template/src/shared/config.luam +0 -5
- package/template/src/shared/framework/command.luam +0 -54
- package/template/src/shared/framework/core.luam +0 -58
- package/template/src/shared/framework/event.luam +0 -39
- package/template/src/shared/framework/listener.luam +0 -40
- package/template/src/shared/framework/loader.luam +0 -73
- package/template/src/shared/framework/thread-pool.luam +0 -27
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
class Command {
|
|
2
|
-
core: any = nil
|
|
3
|
-
name: string = ''
|
|
4
|
-
aliases: string[] = {}
|
|
5
|
-
description: string = ''
|
|
6
|
-
|
|
7
|
-
constructor(core: any) {
|
|
8
|
-
self.core = core
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
execute(player: any, ...): void {
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
names(): string[] {
|
|
15
|
-
local found: string[] = {}
|
|
16
|
-
|
|
17
|
-
if self.name ~= '' then
|
|
18
|
-
table.insert(found, self.name)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
for index = 1, #self.aliases do
|
|
22
|
-
table.insert(found, self.aliases[index])
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
return found
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
handler(): any {
|
|
29
|
-
local command: Command = self
|
|
30
|
-
|
|
31
|
-
if self.core:isServer() then
|
|
32
|
-
return function(player: any, invoked: string, ...)
|
|
33
|
-
command:execute(player, ...)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
return function(invoked: string, ...)
|
|
38
|
-
command:execute(nil, ...)
|
|
39
|
-
end
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
register(): number {
|
|
43
|
-
local registered: number = 0
|
|
44
|
-
local found: string[] = self:names()
|
|
45
|
-
|
|
46
|
-
for index = 1, #found do
|
|
47
|
-
addCommandHandler(found[index], self:handler())
|
|
48
|
-
|
|
49
|
-
registered += 1
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
return registered
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
class Core {
|
|
2
|
-
side: string = 'shared'
|
|
3
|
-
listeners: any = nil
|
|
4
|
-
commands: any = nil
|
|
5
|
-
started: boolean = false
|
|
6
|
-
|
|
7
|
-
constructor(side: string) {
|
|
8
|
-
self.side = side
|
|
9
|
-
self.listeners = {}
|
|
10
|
-
self.commands = {}
|
|
11
|
-
self.started = false
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
isServer(): boolean {
|
|
15
|
-
return self.side == 'server'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
isClient(): boolean {
|
|
19
|
-
return self.side == 'client'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
log(message: string): void {
|
|
23
|
-
outputDebugString('[' .. self.side .. '] ' .. message)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
start(): boolean {
|
|
27
|
-
if self.started then
|
|
28
|
-
return false
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
self.started = true
|
|
32
|
-
|
|
33
|
-
local loader: Loader = new Loader(self)
|
|
34
|
-
|
|
35
|
-
self.listeners = loader:loadListeners()
|
|
36
|
-
self.commands = loader:loadCommands()
|
|
37
|
-
|
|
38
|
-
self:log('loaded ' .. #self.listeners .. ' listener(s) and ' .. #self.commands .. ' command(s)')
|
|
39
|
-
|
|
40
|
-
return true
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
stop(): boolean {
|
|
44
|
-
if not self.started then
|
|
45
|
-
return false
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
for index = 1, #self.listeners do
|
|
49
|
-
self.listeners[index]:unregister()
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
self.listeners = {}
|
|
53
|
-
self.commands = {}
|
|
54
|
-
self.started = false
|
|
55
|
-
|
|
56
|
-
return true
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
class Event {
|
|
2
|
-
name: string = ''
|
|
3
|
-
element: any = nil
|
|
4
|
-
handler: any = nil
|
|
5
|
-
attached: boolean = false
|
|
6
|
-
|
|
7
|
-
constructor(name: string, element: any, handler: any) {
|
|
8
|
-
self.name = name
|
|
9
|
-
self.element = element
|
|
10
|
-
self.handler = handler
|
|
11
|
-
self.attached = false
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
attach(): boolean {
|
|
15
|
-
if self.attached then
|
|
16
|
-
return false
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
self.attached = addEventHandler(self.name, self.element, self.handler)
|
|
20
|
-
|
|
21
|
-
return self.attached
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
detach(): boolean {
|
|
25
|
-
if not self.attached then
|
|
26
|
-
return false
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
removeEventHandler(self.name, self.element, self.handler)
|
|
30
|
-
|
|
31
|
-
self.attached = false
|
|
32
|
-
|
|
33
|
-
return true
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
describe(): string {
|
|
37
|
-
return self.name
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -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
|
-
}
|
package/template/gitignore
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
class HelloCommand extends Command {
|
|
2
|
-
name: string = 'hello'
|
|
3
|
-
aliases: string[] = { 'hi', 'greet' }
|
|
4
|
-
description: string = 'Greets the calling player with the configured message.'
|
|
5
|
-
|
|
6
|
-
execute(player: any, ...): void {
|
|
7
|
-
outputChatBox(formatPlayerLabel(tostring(Config.greeting)), player)
|
|
8
|
-
}
|
|
9
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
local core: Core = new Core('server')
|
|
2
|
-
|
|
3
|
-
addEventHandler('onResourceStart', resourceRoot, function()
|
|
4
|
-
core:start()
|
|
5
|
-
|
|
6
|
-
outputServerLog(`[${process.env.SERVER_NAME}] started with room for ${process.env.MAX_PLAYERS} players.`)
|
|
7
|
-
end)
|
|
8
|
-
|
|
9
|
-
addEventHandler('onResourceStop', resourceRoot, function()
|
|
10
|
-
core:stop()
|
|
11
|
-
end)
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
class Command {
|
|
2
|
-
core: any = nil
|
|
3
|
-
name: string = ''
|
|
4
|
-
aliases: string[] = {}
|
|
5
|
-
description: string = ''
|
|
6
|
-
|
|
7
|
-
constructor(core: any) {
|
|
8
|
-
self.core = core
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
execute(player: any, ...): void {
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
names(): string[] {
|
|
15
|
-
local found: string[] = {}
|
|
16
|
-
|
|
17
|
-
if self.name ~= '' then
|
|
18
|
-
table.insert(found, self.name)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
for index = 1, #self.aliases do
|
|
22
|
-
table.insert(found, self.aliases[index])
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
return found
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
handler(): any {
|
|
29
|
-
local command: Command = self
|
|
30
|
-
|
|
31
|
-
if self.core:isServer() then
|
|
32
|
-
return function(player: any, invoked: string, ...)
|
|
33
|
-
command:execute(player, ...)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
return function(invoked: string, ...)
|
|
38
|
-
command:execute(nil, ...)
|
|
39
|
-
end
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
register(): number {
|
|
43
|
-
local registered: number = 0
|
|
44
|
-
local found: string[] = self:names()
|
|
45
|
-
|
|
46
|
-
for index = 1, #found do
|
|
47
|
-
addCommandHandler(found[index], self:handler())
|
|
48
|
-
|
|
49
|
-
registered += 1
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
return registered
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
class Core {
|
|
2
|
-
side: string = 'shared'
|
|
3
|
-
listeners: any = nil
|
|
4
|
-
commands: any = nil
|
|
5
|
-
started: boolean = false
|
|
6
|
-
|
|
7
|
-
constructor(side: string) {
|
|
8
|
-
self.side = side
|
|
9
|
-
self.listeners = {}
|
|
10
|
-
self.commands = {}
|
|
11
|
-
self.started = false
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
isServer(): boolean {
|
|
15
|
-
return self.side == 'server'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
isClient(): boolean {
|
|
19
|
-
return self.side == 'client'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
log(message: string): void {
|
|
23
|
-
outputDebugString('[' .. self.side .. '] ' .. message)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
start(): boolean {
|
|
27
|
-
if self.started then
|
|
28
|
-
return false
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
self.started = true
|
|
32
|
-
|
|
33
|
-
local loader: Loader = new Loader(self)
|
|
34
|
-
|
|
35
|
-
self.listeners = loader:loadListeners()
|
|
36
|
-
self.commands = loader:loadCommands()
|
|
37
|
-
|
|
38
|
-
self:log('loaded ' .. #self.listeners .. ' listener(s) and ' .. #self.commands .. ' command(s)')
|
|
39
|
-
|
|
40
|
-
return true
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
stop(): boolean {
|
|
44
|
-
if not self.started then
|
|
45
|
-
return false
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
for index = 1, #self.listeners do
|
|
49
|
-
self.listeners[index]:unregister()
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
self.listeners = {}
|
|
53
|
-
self.commands = {}
|
|
54
|
-
self.started = false
|
|
55
|
-
|
|
56
|
-
return true
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
class Event {
|
|
2
|
-
name: string = ''
|
|
3
|
-
element: any = nil
|
|
4
|
-
handler: any = nil
|
|
5
|
-
attached: boolean = false
|
|
6
|
-
|
|
7
|
-
constructor(name: string, element: any, handler: any) {
|
|
8
|
-
self.name = name
|
|
9
|
-
self.element = element
|
|
10
|
-
self.handler = handler
|
|
11
|
-
self.attached = false
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
attach(): boolean {
|
|
15
|
-
if self.attached then
|
|
16
|
-
return false
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
self.attached = addEventHandler(self.name, self.element, self.handler)
|
|
20
|
-
|
|
21
|
-
return self.attached
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
detach(): boolean {
|
|
25
|
-
if not self.attached then
|
|
26
|
-
return false
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
removeEventHandler(self.name, self.element, self.handler)
|
|
30
|
-
|
|
31
|
-
self.attached = false
|
|
32
|
-
|
|
33
|
-
return true
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
describe(): string {
|
|
37
|
-
return self.name
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -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
|
-
}
|