Exam Editor
Overview
Launch a standalone Exam creation and editing experience.
Endpoints
Launch URL (new exam): /lti/launch/author/exam
Launch URL (existing exam): /lti/launch/author/exam/<id>
📄 Additional Parameters
{
id?: string | undefined;
}
📅 Events
LAUNCHED
Emitted immediately after the Campfire application finished loading.
EXAM_SAVED
Emitted every time the item is saved to our database, including during creation
data: {
id: string;
}
EXAM_CREATED
Emitted the first time an item is saved to our database
data: {
id: string;
}
Additionally, the Exam Editor may emit any of the events from Item Editor if the user launches the Item Editor while creating their exam.
☎️ Messages
None
🚀 Quick Start Example
HTML/JS
<!DOCTYPE html>
<html>
<head>
<title>Campfire SDK Samples</title>
<link rel="stylesheet"
href="https://unpkg.com/modern-normalize@2.0.0/modern-normalize.css" />
<script
src="https://unpkg.com/@campfirelearning/sdk-lti@0.6.1/dist/browser/index.js"></script>
<script
src="https://unpkg.com/@campfirelearning/sdk-lti-oauth@0.0.2/dist/browser/index.js"></script>
<style type="text/css">
body, html {
height: 100%;
}
iframe {
width: 100%;
height: 90vh;
border: none;
flex: 1;
min-height: 0;
}
div#app {
padding: 0;
height: 100%;
display: flex;
flex-direction: column;
}
div#app > h1 {
padding: 1rem;
margin: 0;
font-size: 1rem;
border-bottom: solid 1px #999;
}
</style>
</head>
<body>
<div id="app">
<h1>🔥 <a href=".">Campfire SDK Samples</a></h1>
<iframe id="tool" name="tool"></iframe>
</div>
<script>
const consumer = new CampfireSDK.ExamEditor({
params: {
oauth_consumer_key: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
resource_link_id: "0",
user_id: "foo@bar.com",
lis_person_contact_email_primary: "foo@bar.com",
lis_person_name_given: "Kevin",
lis_person_name_family: "Campbell",
lis_person_name_full: `Kevin Campbell`,
roles: [
"Instructor",
"urn:lti:instrole:ims/lis/Administrator",
"urn:lti:sysrole:ims/lis/SysAdmin",
].join(","),
},
/** UNSAFE: For Development Only */
signingFunction: (url) => CampfireOAuth.getUnsafeOauthSigningFunction({
launchUrl: url,
secretKey: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}),
});
consumer.addEventListener("message", (message) => {
console.log("Message received", message.data)
switch (message.data.name){
case "examClosed":
alert("User is requesting to close the exam editor");
break;
case "examCreated":
alert("User has created an exam! (ID: " + message.data.data.id + ")");
break;
case "itemCreated":
alert("User has created an item in the exam! (ID: " + message.data.data.log + ")");
break;
}
})
consumer.mount("tool").then(() => {
console.log("Mounted!");
});
</script>
</body>
</html>