CustomWordList

CustomWordList

Class representing a list of custom words. A CustomWordList is a dummy class that helps to iterate over and perform operations on the user's custom words which are loaded from browser storage.

Constructor

new CustomWordList(wordList, locale)

Create a CustomWordList. Words are sorted alphabetically using the provided locale on creation
Source:
Parameters:
Name Type Description
wordList WordList | Array.<string> an array of custom words or object of words and languages
locale string the locale (i.e. 'en' or 'de') used to sort the custom words

Members

wordList

Get an unsorted wordList object that includes each word and the languages it is misspelt in
Source:

words

Get all custom words
Source:

Methods

add(word, languages)

Adds a word to the CustomWordList. Note that adding a word does not call sort().
Source:
Parameters:
Name Type Description
word string word to add
languages Array.<string> the languages the word the word is misspelt in

remove(word)

Removes a word from the CustomWordList
Source:
Parameters:
Name Type Description
word string word to be remove

sort(locale)

Sort all custom words alphabetically based on a specific locale
Source:
Parameters:
Name Type Description
locale string a two character length language string (i.e. 'de' or 'es')