WKW - Client Side JS Wrapper for WaniKani API
Properties
getUserfunction takes an api key and returns a user object
Prototype for user's data objects. Contains basic state and functionality (e.g., expiration and emptiness).
Properties
timenumber the expiration time for this data typeisEmptyboolean whether or not this object is "empty"apiResourceLocstring the location of this data type from the API's URLuserResourceLocstring the name of this data type's key in the user objectexpirationnumber unix timestamp for when this object was createdisExpiredfunction returns whether or not this data has expired
Factory function for objects that have proto as their prototype.
Parameters
overridesobject properties to overwrite in this object's prototype
Returns object an object whose prototype is proto
User information prototype (user.user_information)
Properties
usernamestring user's usernamegravatarstring md5 gravatar hash for user's avatarlevelnumber user's leveltitlestring user's titleaboutstring user's about mewebsitestring user's website URLtwitterstring user's twitter handletopics_countnumber number of topics on message boardposts_countnumber number of posts made by usercreation_datenumber unix timestamp for account creationvacation_date(number | null) unix timestamp for vacation setting
Study queue prototype (user.study_queue)
Properties
lessons_availablenumber number of lessons currently availablereviews_availablenumber number of reviews currently availablenext_review_date(number | null) unix timestamp for next review (or null if vacation mode)reviews_available_next_hournumber number of reviews available within the next hourreviews_available_next_daynumber number of reviews available within the next day
Level progression prototype (user.level_progression)
Properties
radicals_progressnumber number of radicals completed for the current levelradicals_totalnumber total number of radicals for this levelkanji_progressnumber number of kanji completed for the current levelkanji_totalnumber total number of kanji for this level
SRS distribution prototype (user.srs_distribution)
Properties
apprenticeobject items at apprentice levelguruobject items at guru level (same structure as apprentice)masterobject items at master level (same structure as apprentice)enlightenobject items at enlighten level (same structure as apprentice)burnedobject items at burned level (same structure as apprentice)
Simple list interface object that provides useful functionality to list data objects.
Returns an array of objects whose specified properties have the specified value.
Parameters
propstring the property of each object to look undervaluestring the value to look for of said property
Returns array contains objects whose prop are value
Recent unlocks list prototype (user.recent_unlocks) 3 different types of objects in here For an example of the objects stored, please see the WaniKani API.
See listInterface
Returns array containing all radicals in this
Returns array containing all kanji in this
Returns array containing all vocabulary in this
Parameters
characterstring desired character
Returns array containing all items in this with the given character
Parameters
meaningstring desired meaning
Returns array containing all items in this with the given meaning
Parameters
levelnumber desired level
Returns array containing all items in this with the given level
Parameters
unlocked_datenumber desired unlocked_date
Returns array containing all items in this with the given unlocked date
Critical items list prototype (user.critical_items) 3 different types of objects in here For an example of the objects stored, please see the WaniKani API.
See listInterface
Returns array containing all radicals in this
Returns array containing all kanji in this
Returns array containing all vocabulary in this
Parameters
characterstring desired character
Returns array containing all items in this with the given character
Parameters
meaningstring desired meaning
Returns array containing all items in this with the given meaning
Parameters
levelnumber desired level
Returns array containing all items in this with the given level
Parameters
percentagenumber desired percentage
Returns array containing all items in this with the given percentage
Radicals list prototype (user.radicals) For an example of the objects stored, please see the WaniKani API.
See listInterface
Parameters
characterstring desired character
Returns array containing all items in this with the given character
Parameters
meaningstring desired meaning
Returns array containing all items in this with the given meaning
Parameters
imagestring desired image URL
Returns array containing all items in this with the given image url
Parameters
levelnumber desired level
Returns array containing all items in this with the given level
Kanji list prototype (user.kanji) For an example of the objects stored, please see the WaniKani API.
See listInterface
Parameters
characterstring desired character
Returns array containing all items in this with the given character
Parameters
meaningstring desired meaning
Returns array containing all items in this with the given meaning
Parameters
important_readingstring desired important reading
Returns array containing all items in this with given reading
Parameters
levelnumber desired level
Returns array containing all items in this with the given level
Vocabulary list prototype (user.vocabulary) For an example of the objects stored, please see the WaniKani API.
See listInterface
Parameters
characterstring desired character
Returns array containing all items in this with the given character
Parameters
kanastring desired hiragana or katakana
Returns array containing all items in this with the given kana
Parameters
meaningstring desired meaning
Returns array containing all items in this with the given meaning
Parameters
levelnumber desired level
Returns array containing all items in this with the given level
Performs a deep copy on parent over to child. Catches objects / arrays.
Parameters
Updates rate limiting information before making a request to the API.
Parameters
userobject the user object
Retrieves data for given object. Takes a spec object with the following attributes:
Parameters
specobject spec object for passing params
Returns object a Promise object
Checks if an object is expired or empty.
Parameters
objobject object to check
Returns boolean whether or not the object is expired or empty
Checks if given numbers are valid for certain parameters. (e.g., levels, percentages, etc.)
Parameters
numbers(string | number) numbers requestedminnumber the min the numbers can bemaxnumber the max the numbers can be
Returns boolean whether or not the given numbers are valid
Returns object a spec object for any given getter method which should be handed over to retrieveObjectData.
prototype object for users
Returns boolean true if the user is rate limited, false otherwise.
Retrieves the user's information.
Parameters
forceboolean whether or not to force the call to the api
Returns object a Promise object
Retrieves the user's study queue.
Parameters
forceboolean whether or not to force the call to the api
Returns object a Promise object
Retrieves the user's level progression.
Parameters
forceboolean whether or not to force the call to the api
Returns object a Promise object
Retrieves the user's SRS distribution.
Parameters
forceboolean whether or not to force the call to the api
Returns object a Promise object
Retrieves the user's recent unlocks list.
Parameters
limitstring limit for number of items returnedforceboolean whether or not to force the call to the api
Returns object a Promise object
Retrieves the user's critical items list.
Parameters
Returns object a Promise object
Retrieves the user's radicals list.
Parameters
Returns object a Promise object
Retrieves the user's kanji list.
Parameters
Returns object a Promise object
Retrieves the user's voabulary list.
Parameters
levels(string | number) vocabulary of given level(s)forceboolean whether or not to force the call to the api
Returns object a Promise object
Retrieves all data for the user.
Returns object a Promise object
Factory for user objects.
Parameters
api_keynumber user's WK API key
Returns object a User object
Tests whether or not browser supports local storage.
Parameters
type
Returns boolean true if supported, false otherwise
Retrieves any data from localStorage and keeps a local cache inside the users object. Called on initializing WKW and available in debug.
Saves the local cache of users (the users object) in localStorage. Called after any data is updated.