Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@upandgo/react-scorm-provider

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@upandgo/react-scorm-provider - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

5

lib/index.d.ts

@@ -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 @@ };

45

lib/ScormProvider.js

@@ -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 @@

3

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc