Class: BasePets

Pets~ BasePets


new BasePets()

Manages base information for all pet species.
Source:

Members


<private> _baseFile :string

The filename of the file to read pet information from.
Type:
  • string
Default Value:
  • ./save/pets.json
Source:

<private> _pets :object

Parsed data from file.
Type:
  • object
Default Value:
  • {}
Source:

Methods


<private> _fileUpdate(curr, prev)

File has been modified, re-read and parse data.
Parameters:
Name Type Description
curr fs.Stats Current file stats.
prev fs.Stats Previous file stats.
Source:

<private> _readFile()

Read and parse data from the file.
Source:

get(species)

Fetch base object for a species.
Parameters:
Name Type Description
species string Name of species to fetch.
Source:
Returns:
Object reference of pet information for the species, or null if could not be found.
Type
object

initialize()

Start watching file system changes and read pet information from file.
Source:

random()

Fetch a base object for a random species.
Source:
Returns:
Object reference of pet information for the species, or null if could not be found.
Type
object

shutdown()

Stop watching for file system changes, and remove all event listeners.
Source: