scan refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-01-27 18:29:17 +01:00
parent e5c36dd962
commit 6d9428e170
3 changed files with 20 additions and 18 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
## Interface: 11200
## Title: Aux
## Notes: A lightweight addon designed to help manage auctions
## SavedVariablesPerCharacter: aux_recently_searched, aux_view, AUX_SELL_SHORTCUT, AUX_BUY_SHORTCUT, AUX_OPEN_SELL, AUX_OPEN_BUY, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
## SavedVariablesPerCharacter: aux_recently_searched, aux_view, AUX_AUCTION_DURATION
## SavedVariables: aux_database, aux_auctionable_items
slash.lua
@@ -11,6 +11,7 @@ control.xml
persistence.lua
util.lua
money.lua
groups.lua
scan.lua
scan_util.lua
View File
+18 -17
View File
@@ -11,35 +11,36 @@ local controller = (function()
end
end)()
local state, abort, new_job
local state
local scan, scan_auctions, scan_auctions_helper, submit_query, wait_for_callback, wait_for_results, wait_for_owner_data, abort
local scan, scan_auctions, scan_auctions_helper, submit_query, wait_for_callback, wait_for_results, wait_for_owner_data, on_abort
function Aux.scan.start(job)
Aux.control.on_next_update(function()
abort()
return controller().wait(function() return true end, function()
on_abort()
job.type = job.type or 'list'
state = {
job = job,
page = job.page
job = job,
page = job.page
}
return scan()
end)
scan()
end)
end
function Aux.scan.abort(k)
Aux.control.on_next_update(function()
abort()
if k then
return k()
end
end)
controller().wait(function() return true end, function()
on_abort()
state = nil
if k then
return k()
end
end)
end
function abort()
controller().reset()
function on_abort()
if state and state.job and state.job.on_abort then
state.job.on_abort()
end