@newtonschool/react_proctoring_library 0.0.84 → 0.0.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,15 +10,19 @@ var _ElectronContext = require("../../contexts/ElectronContext");
10
10
  function useIllegalKeysCombination() {
11
11
  const [keysClickedCount, setKeysClickedCount] = (0, _react.useState)(0);
12
12
  const isElectronApp = (0, _react.useContext)(_ElectronContext.ElectronContext);
13
+ const illegalKeysClickHandler = () => {
14
+ setKeysClickedCount(count => count + 1);
15
+ };
13
16
  (0, _react.useEffect)(() => {
14
17
  if (isElectronApp) {
15
- const illegalKeysClickHandler = () => {
16
- setKeysClickedCount(count => count + 1);
17
- };
18
- const signal = window.electron.listener.illegalKeysCombinationDetected(illegalKeysClickHandler);
19
- return () => {
20
- window.electron.listener.removeListener(signal, illegalKeysClickHandler);
21
- };
18
+ try {
19
+ const signal = window.electron.listener.illegalKeysCombinationDetected(illegalKeysClickHandler);
20
+ return () => {
21
+ window.electron.listener.removeListener(signal, illegalKeysClickHandler);
22
+ };
23
+ } catch (e) {
24
+ console.error(e);
25
+ }
22
26
  }
23
27
  }, [isElectronApp]);
24
28
  return keysClickedCount;
@@ -4,20 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useCleanupPermissions = void 0;
7
- var _react = require("react");
8
7
  var _permission = require("../utils/permission");
9
8
  const useCleanupPermissions = _ref => {
10
9
  let {
11
- proctoredContext
10
+ proctoredContextData
12
11
  } = _ref;
13
- const {
14
- references,
15
- screenshareStream,
16
- permissionSetter,
17
- streamSetter,
18
- allPermissionGrantedOnce
19
- } = (0, _react.useContext)(proctoredContext);
12
+ if (!proctoredContextData) {
13
+ return () => {};
14
+ }
20
15
  const cleanupPermissions = () => {
16
+ const {
17
+ references,
18
+ screenshareStream,
19
+ permissionSetter,
20
+ streamSetter,
21
+ allPermissionGrantedOnce
22
+ } = proctoredContextData;
21
23
  const screenShareReference = references.screenshareReference;
22
24
  const setScreensharePermission = permissionSetter.screenshare;
23
25
  const setScreenshareStream = streamSetter.screenshare;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtonschool/react_proctoring_library",
3
- "version": "0.0.84",
3
+ "version": "0.0.86",
4
4
  "description": "Used to proctor online tests",
5
5
  "author": "ayushkagrawal,shreyachandra,weastel",
6
6
  "main": "dist/index.js",