Skip to content

Commit

Permalink
add notes asynchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsumoto-ren committed Nov 3, 2020
1 parent a9911bb commit 46e4b41
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions subs2srs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,15 @@ ankiconnect.add_note = function(note_fields, gui)
}
}
}

local ret = ankiconnect.execute(args)
local result, error = ankiconnect.parse_result(ret)

if error == nil then
notify(string.format("Note added. ID = %s.", result))
else
notify(string.format("Error: %s.", error), "error", 2)
local result_notify = function(_, result, _)
local note_id, error = ankiconnect.parse_result(result)
if not error then
notify(string.format("Note added. ID = %s.", note_id))
else
notify(string.format("Error: %s.", error), "error", 2)
end
end
ankiconnect.execute(args, result_notify)
end

ankiconnect.get_last_note_id = function()
Expand Down

0 comments on commit 46e4b41

Please sign in to comment.