Libram (Library)
From WoWWiki
- For info regarding the in-game item known as a Libram, see this page.
"DRY - Don't Repeat Yourself." - David Thomas & Andrew Hunt
Libram is a QuestLog notification system. It will tell you exactly what changed, when it changes. This addon is a function library. This means that it doesn't have any UI on its own, but rather provides functionality for other addons. If you are an addon user and not an addon developer all you need to do is to leave this addon turned on if you have any other addons that depend on it.
Examples:
myCallback = function(action, questInfo)
if (action==LIBRAM_QUEST_ADDED) then
Sea.io.print("New Quest Found: ", questInfo.title);
end
end;
Libram.registerScholar({id="MyScholar";callback=myCallback;description="My New Quest Announcer"});
Will print "New Quest Found: [Quest Title Here]" when a new quest is added to the quest log.
Contents |
Libram Documentation
If you modify something that will require an update to the source code, leave a note on Alex's talk page (click new note to leave message there).
Libram Functions
- registerScholar - registers a scholar who calls you when the log changes
- unregisterScholar - removes the scholar you registered
- validateScholar - confirms a scholar is valid
- requestHistory - returns the player's quest log
- requestRecord - returns detailed information about a single quest in the player's requested history
Libram Data Types
- Libram Scholar - the scholar who will call you when things change
- Libram History - the player's history (quest log)
- Libram Record - the detailed information on a specific history item
- Libram Action - the action that the scholar informs you has occurred
Using Libram
Libram is designed to make watching the quest log a lot easier. For instance, lets say you wanted to know when a new quest was added to the quest log. You could either a) iterate through every quest or b) register a scholar and watch for the LIBRAM_QUEST_ADD event from your scholar. Plus, if you use Libram.requestRecord, you ensure you don't accidentally refresh the player's quest log.
Important Points about Libram
Do not do a gui update as a result of the Scholar's callback. If you do, you ensure your addon will cause lag for your users. Instead, record the action and update your gui later, after a delay.
