Global

Members

constellationList

Properties:
Name Type Description
init function retrieves info from previous page
initializeConstellation function initalize constellations
stopTalkWhenReload function stop voice over when reload/back a page
stopSpeechSynthesis function stop voice over
Source:

Methods

addSessionCategorySelected(category)

Change the category selected of the current session
Parameters:
Name Type Description
category string category name to set to
Source:

addSessionClick(click)

Add a mouse click event to the sessions click history
Parameters:
Name Type Description
click Array coordinates of downclick and upclick, in nested length 2 arrays
Source:

addSessionError(pageName, name, message, stack)

Add an error to current session
Parameters:
Name Type Description
pageName string page name that the error occured on
name string top level name of error
message string error message
stack string string representation of the stack trace at error
Source:

addSessionPageTime(pageName, time)

Add to current time on page, by a specified amount
Parameters:
Name Type Description
pageName string page name to add time to
time number amount of time to increment by
Source:

animate()

Properties:
Name Type Description
Animation function loop to update the skymap
Source:

animateText(answer, textElement)

Function to show the response text word by word.
Parameters:
Name Type Description
answer string The response answer.
textElement HTMLElement The text element to animate.
Source:

defaultPageAnalytics(pageName, status)

This function tags a page with duration tracking, and error tracking Requires a string for the current page name, and status of being on this page
Parameters:
Name Type Description
pageName string page name of current page
status int status code to post when this page is left from
Source:

displayText(answer, textElement)

Function to display text.
Parameters:
Name Type Description
answer string The text to display.
textElement HTMLElement The text element to display the text in.
Source:

fetchResponses(questionInput, chosenConstellation) → {Promise.<string>}

Function to fetch response from the JSON file.
Parameters:
Name Type Description
questionInput string The question input.
chosenConstellation string The chosen constellation.
Source:
Returns:
A promise that resolves with the fetched response.
Type
Promise.<string>

getEmptySession() → {JSONObject}

Create an empty session for analytics usage, uses default/empty values
Source:
Returns:
JSON object representing current session
Type
JSONObject

getSession() → {JSONObject}

Get the current session. If no current session exists, creates an empty session and returns it
Source:
Returns:
JSON object representing current session
Type
JSONObject

goToPage()

Properties:
Name Type Description
Navigation function
Source:

handleClickCanvas(event, constellation_arr, sky_background)

Handle click when the user click on the canvas to trigger the star click and count the total if clicked on the star.
Parameters:
Name Type Description
event Event
constellation_arr Constellation
sky_background Background
Source:

handleStart()

Properties:
Name Type Description
Handle function click on start button
Source:

init()

Retrieves info from previous page
Source:

init()

Properties:
Name Type Description
initialize function function, called once whole DOM is parsed
Source:

(async) init()

Properties:
Name Type Description
Starts function the program, all function calls trace back here
Source:

(async) init()

Directs user back to the landing page
Source:

initializeConstellation()

Initialize the info from the previuos page
Source:

initializeVoicing()

Properties:
Name Type Description
Initialize function the voicing text selection and buttons
Source:

(async) loadJsonData()

Properties:
Name Type Description
Helper function function to load json data for constellation and stars
Source:
Returns:
cloc, connect constellation location and connect

makeid(length)

This function generates a random id of length
Parameters:
Name Type Description
length number
Source:
Returns:
a random string of provided length

populateDropdown()

Properties:
Name Type Description
Helper function function that populates the dropdown menu for the voice selection
Source:

redirectToPage(url)

Function to redirect to a page.
Parameters:
Name Type Description
url string The URL of the page to redirect to.
Source:

sessionStarSelectedInc()

Increment the starselected for the session
Source:

setCanvasPanning(canvas, sky_background)

Set up canvas with panning
Parameters:
Name Type Description
canvas HTMLCanvasElement
sky_background Background
Source:
Returns:
cameraOffset Reference: https://codepen.io/chengarda/pen/wRxoyB

setCategoryEffect(categoryButton, categoryName, iconURL)

Set mouse evens for category button to trigger category icon effect
Parameters:
Name Type Description
categoryButton HTMLButtonElement
categoryName String
iconURL Strong
Source:

setEmptySession()

Set the current session to empty
Source:

setRatio()

Properties:
Name Type Description
Calculate function background ratio according to the user screen size (2:1 of the screen size)
Source:

setSelection(passedButton, continueButton)

All buttons besides the passed button are set to deselected, if the passed button is already selected, its colors become deselected and the selected question type is reset, the button to continue only becomes available when a button is set to selected
Parameters:
Name Type Description
passedButton Button
continueButton Button
Source:

setSessionExit(pageName)

Set the exit page name
Parameters:
Name Type Description
pageName string page name to be written
Source:

setSessionStatus(status)

Set the status of the session to either 0=success, or 1=error/exit
Parameters:
Name Type Description
status number status code to be entered
Source:

setShootingStars(document)

Set background shooting star animation Require: HTMLDivElement id="stars-div"
Parameters:
Name Type Description
document Document document of target page
Source:

stopSpeechSynthesis()

stops speech
Source:

stopTalkWhenReload()

voiceover stops when page reloaded/goes to previuos page.
Source:

toLandingPage()

Directs user back to the landing page
Source:

toSkyMapPage()

Properties:
Name Type Description
Adds function the type of question into localStorage under the key "questionType", and routes to skymap page.
Source:

tutorialSetup()

Properties:
Name Type Description
Set function up the tutorial dialog
Source:

writeSession(sessionJSON)

Writes a session to local storage
Parameters:
Name Type Description
sessionJSON JSONObject session object to be written
Source: