@upandgo/react-scorm-container
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,24 +0,4 @@ | ||
import * as React from "react"; | ||
import { LMSState, SCORMVersion, SCORMEvent } from "./lms"; | ||
export declare type Props = { | ||
bridgeUrl: string; | ||
manifestUrl: string; | ||
width?: string; | ||
height?: string; | ||
initialState: LMSState; | ||
commitCallback: (state: LMSState, eventList: SCORMEvent[]) => void; | ||
}; | ||
declare type State = { | ||
version?: SCORMVersion; | ||
moduleUrl?: string; | ||
}; | ||
export default class ExampleComponent extends React.Component<Props, State> { | ||
scormIFrame: React.RefObject<HTMLIFrameElement>; | ||
constructor(props: Props); | ||
componentDidMount(): void; | ||
fetchManifest: () => Promise<void>; | ||
initSCORMListener: () => void; | ||
sendStateToBridge: () => void; | ||
render(): JSX.Element; | ||
} | ||
export {}; | ||
import container from "./container"; | ||
export default container; | ||
import { IncomingMessage, InputMessage, Interaction, LMSState, Objective, SCORMEvent } from "./lms"; | ||
export { IncomingMessage, InputMessage, Interaction, LMSState, Objective, SCORMEvent }; |
@@ -54,2 +54,1 @@ export declare type SCORMVersion = "1.2" | "2004"; | ||
export declare const getModuleURLFromIMSManifestContent: (imsmanifestUrl: string, content: any) => string; | ||
export declare const parseIMSManifest: () => void; |
{ | ||
"name": "@upandgo/react-scorm-container", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A React component acting as a LMS, listening to SCORM API events and reacting to SCORM API call.", | ||
@@ -5,0 +5,0 @@ "author": "Sangrene", |
@@ -20,21 +20,23 @@ # react-scorm-container | ||
```tsx | ||
import * as React from 'react' | ||
import React, { Component } from 'react' | ||
import ScormContainer, { LMSState } from 'react-scorm-container' | ||
import ExampleComponent from 'react-scorm-container' | ||
class Example extends React.Component { | ||
export default class App extends Component { | ||
handleCommit = (newState: LMSState) => { | ||
console.log(newState); | ||
handleCommit = (state, eventList) => { | ||
console.log(state); | ||
console.log(eventList); | ||
} | ||
render () { | ||
render() { | ||
return ( | ||
<ScormContainer | ||
version="2004" | ||
bridgeUrl="http://example.com/my-bridge" | ||
moduleUrl="http://example.com/my-module" | ||
initialState={{}} | ||
commitCallback={handleCommit} | ||
/> | ||
<div style={{ minHeight: "100vh" }}> | ||
<ExampleComponent | ||
bridgeUrl="http://scorm-modules.s3-website-eu-west-1.amazonaws.com" | ||
manifestUrl='http://scorm-modules.s3-website-eu-west-1.amazonaws.com/1380de9b-664d-4b20-a2c3-4a966bcaec26/imsmanifest.xml' | ||
initialState={{}} | ||
commitCallback={this.handleCommit} | ||
/> | ||
</div> | ||
) | ||
@@ -41,0 +43,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
69296
10
416
49