Skip to content

Commit

Permalink
feat: add flag to allow submission of summary score with interactive …
Browse files Browse the repository at this point in the history
…book
  • Loading branch information
0xMurage committed Jan 3, 2025
1 parent e36067e commit ca02bdb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/h5p-standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ interface Options {
preventH5PInit?: boolean;
embedType?: 'div' | 'iframe';

// following options are ripped from interactive book https://github.com/h5p/h5p-interactive-book/blob/6373b8440b0ef5eaf25fe21cae8ad57e9f8d8a9e/src/scripts/app.js#L57-L61
reportingIsEnabled?: boolean;

contentUserData?: H5PContent['contentUserData'];
saveFreq?: number | false;
postUserStatistics?: boolean;
Expand Down Expand Up @@ -257,6 +260,8 @@ export class H5PStandalone {
H5PIntegration.urlLibraries = librariesPath;
H5PIntegration.postUserStatistics = !!options.postUserStatistics

H5PIntegration.reportingIsEnabled= options.reportingIsEnabled

//since the default is false, only set if it's a number?
if (options.saveFreq && typeof options.saveFreq === 'number') {
H5PIntegration.saveFreq = options.saveFreq;
Expand Down
1 change: 1 addition & 0 deletions src/h5p.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface H5PIntegration {

saveFreq?: false | number;
postUserStatistics?: boolean; //makes sense if user is available
reportingIsEnabled?: boolean; //this option is from interactive book https://github.com/h5p/h5p-interactive-book/blob/6373b8440b0ef5eaf25fe21cae8ad57e9f8d8a9e/src/scripts/app.js#L57-L61
ajax: {
/**
* endpoint where to post results on completion.
Expand Down

0 comments on commit ca02bdb

Please sign in to comment.