@upandgo/react-scorm-provider
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -52,2 +52,7 @@ import React from "react"; | ||
get: (key: ReadableValue) => string; | ||
/** | ||
* Set the score in percentage of validation | ||
*/ | ||
setScore: (score: number) => void; | ||
}; | ||
@@ -54,0 +59,0 @@ }; |
@@ -26,4 +26,2 @@ "use strict"; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -45,3 +43,6 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var ScoContext = _react["default"].createContext({ | ||
isInLMSContext: false, | ||
apiConnected: false, | ||
@@ -72,2 +73,36 @@ learnerName: '', | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(ScormProvider).call(this, props)); | ||
_defineProperty(_assertThisInitialized(_this), "initScoreRange", function () { | ||
if (!_this.state.apiConnected) return; | ||
if (_this.state.isInLMSContext) { | ||
if (_this.state.version === "1.2") { | ||
_this.set("cmi.core.score.min", 0); | ||
_this.set("cmi.core.score.max", 100); | ||
} else { | ||
_this.set("cmi.score.min", 0); | ||
_this.set("cmi.score.max", 100); | ||
} | ||
} else { | ||
localStorage.setItem("score.min", 0); | ||
localStorage.setItem("score.max", 100); | ||
} | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "setScore", function (score) { | ||
if (!_this.state.apiConnected) return; | ||
if (_this.state.isInLMSContext) { | ||
if (_this.state.version === "1.2") { | ||
_this.set("cmi.core.score.raw", score); | ||
} else { | ||
_this.set("cmi.score.raw", score); | ||
} | ||
} else { | ||
localStorage.setItem("score.raw", score); | ||
} | ||
}); | ||
console.log('ScormProvider constructor called!'); // bind class methods as needed | ||
@@ -139,2 +174,4 @@ | ||
}, function () { | ||
_this2.initScoreRange(); | ||
_this2.getSuspendData(); | ||
@@ -149,3 +186,5 @@ }); | ||
}, function () { | ||
return _this2.getSuspendData(); | ||
_this2.initScoreRange(); | ||
_this2.getSuspendData(); | ||
}); // could not create the SCORM API connection | ||
@@ -152,0 +191,0 @@ |
{ | ||
"name": "@upandgo/react-scorm-provider", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Components to easily enable SCORM API communication in React projects.", | ||
@@ -31,2 +31,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"moment": "^2.24.0", | ||
"pipwerks-scorm-api-wrapper": "^0.1.2", | ||
@@ -33,0 +34,0 @@ "prop-types": "^15.7.2" |
# React SCORM Provider | ||
[![npm version](https://badge.fury.io/js/%40upandgo%2Freact-scorm-provider.svg)](https://badge.fury.io/js/%40upandgo%2Freact-scorm-provider) | ||
### Overview | ||
@@ -4,0 +4,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30601
386
5
+ Addedmoment@^2.24.0
+ Addedmoment@2.30.1(transitive)