0.1.2 • Published 2 years ago

odyssey-wasm v0.1.2

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Web testing

Prerequisites:

In root directory:

wasm-pack build

In www directory:

npm install
npm start

Open browser at localhost:8080 and type q = create_simple_quiz().

Now you can interact with quiz:

q = create_open_survey()
q.title // Quiz title
q.description // Quiz description
q.sections // Check all available sections
q.section(1) // Check contents of Section 1
q.question(1) // Check answers and their IDs in Question 1
q.select_answer(1, 1) // Answer 1 in Question 1
q.question(1) // Check that Question 1 is now answered and Answer 1 is now selected
q.input_answer(3, "yo") // Input "yo" as answer to Question 3
q.question(1) // Check that Question 3 is now answered and Answer 1 is now selected and contains "yo"

Quiz can be restored with events:

events_json = JSON.stringify([{event: "selectAnswer", questionId: 1, answerId: 1}])
q = create_open_survey(events_json)
q.question(1) // Check that Question 1 is now answered and Answer 1 is now selected

Quiz can be queried for current event log:

q = create_open_survey()
q.select_answer(1, 1) // Answer 1 in Question 1
q.event_log // Return JSON string of current event log
0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago