mirror of
https://github.com/TrentSPalmer/fcc-challenges.git
synced 2024-11-21 11:21:30 -08:00
add nosleep.js to pomodoro-clock-react
This commit is contained in:
parent
4279f4e75f
commit
120145737e
@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"files": {
|
"files": {
|
||||||
"main.css": "/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css",
|
"main.css": "/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css",
|
||||||
"main.js": "/fcc-challenges/pomodoro-clock-react/build/static/js/main.fc7ef8c4.chunk.js",
|
"main.js": "/fcc-challenges/pomodoro-clock-react/build/static/js/main.56d846f0.chunk.js",
|
||||||
"main.js.map": "/fcc-challenges/pomodoro-clock-react/build/static/js/main.fc7ef8c4.chunk.js.map",
|
"main.js.map": "/fcc-challenges/pomodoro-clock-react/build/static/js/main.56d846f0.chunk.js.map",
|
||||||
"runtime-main.js": "/fcc-challenges/pomodoro-clock-react/build/static/js/runtime-main.601eb45a.js",
|
"runtime-main.js": "/fcc-challenges/pomodoro-clock-react/build/static/js/runtime-main.601eb45a.js",
|
||||||
"runtime-main.js.map": "/fcc-challenges/pomodoro-clock-react/build/static/js/runtime-main.601eb45a.js.map",
|
"runtime-main.js.map": "/fcc-challenges/pomodoro-clock-react/build/static/js/runtime-main.601eb45a.js.map",
|
||||||
"static/js/2.8e985427.chunk.js": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.8e985427.chunk.js",
|
"static/js/2.a6220f55.chunk.js": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.a6220f55.chunk.js",
|
||||||
"static/js/2.8e985427.chunk.js.map": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.8e985427.chunk.js.map",
|
"static/js/2.a6220f55.chunk.js.map": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.a6220f55.chunk.js.map",
|
||||||
"index.html": "/fcc-challenges/pomodoro-clock-react/build/index.html",
|
"index.html": "/fcc-challenges/pomodoro-clock-react/build/index.html",
|
||||||
"precache-manifest.e6fd82d65a64f9d87202c6dab0d433f6.js": "/fcc-challenges/pomodoro-clock-react/build/precache-manifest.e6fd82d65a64f9d87202c6dab0d433f6.js",
|
"precache-manifest.26aca98821ee4880d329b4892a380648.js": "/fcc-challenges/pomodoro-clock-react/build/precache-manifest.26aca98821ee4880d329b4892a380648.js",
|
||||||
"service-worker.js": "/fcc-challenges/pomodoro-clock-react/build/service-worker.js",
|
"service-worker.js": "/fcc-challenges/pomodoro-clock-react/build/service-worker.js",
|
||||||
"static/css/main.1b8ac635.chunk.css.map": "/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css.map",
|
"static/css/main.1b8ac635.chunk.css.map": "/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css.map",
|
||||||
"static/js/2.8e985427.chunk.js.LICENSE.txt": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.8e985427.chunk.js.LICENSE.txt",
|
"static/js/2.a6220f55.chunk.js.LICENSE.txt": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.a6220f55.chunk.js.LICENSE.txt",
|
||||||
"static/media/BeepSound.ogg": "/fcc-challenges/pomodoro-clock-react/build/static/media/BeepSound.049fe0d0.ogg"
|
"static/media/BeepSound.ogg": "/fcc-challenges/pomodoro-clock-react/build/static/media/BeepSound.049fe0d0.ogg"
|
||||||
},
|
},
|
||||||
"entrypoints": [
|
"entrypoints": [
|
||||||
"static/js/runtime-main.601eb45a.js",
|
"static/js/runtime-main.601eb45a.js",
|
||||||
"static/js/2.8e985427.chunk.js",
|
"static/js/2.a6220f55.chunk.js",
|
||||||
"static/css/main.1b8ac635.chunk.css",
|
"static/css/main.1b8ac635.chunk.css",
|
||||||
"static/js/main.fc7ef8c4.chunk.js"
|
"static/js/main.56d846f0.chunk.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1 +1 @@
|
|||||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="#"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/fcc-challenges/pomodoro-clock-react/build/logo192.png"/><link rel="manifest" href="/fcc-challenges/pomodoro-clock-react/build/manifest.json"/><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400&display=swap"><title>Pomodoro Clock React - Build a Pomodoro Clock - Front End Libraries Projects</title><link href="/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"><div><script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script></div></div><script>!function(e){function r(r){for(var o,u,l=r[0],a=r[1],p=r[2],i=0,s=[];i<l.length;i++)u=l[i],Object.prototype.hasOwnProperty.call(n,u)&&n[u]&&s.push(n[u][0]),n[u]=0;for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o]);for(f&&f(r);s.length;)s.shift()();return c.push.apply(c,p||[]),t()}function t(){for(var e,r=0;r<c.length;r++){for(var t=c[r],o=!0,l=1;l<t.length;l++){var a=t[l];0!==n[a]&&(o=!1)}o&&(c.splice(r--,1),e=u(u.s=t[0]))}return e}var o={},n={1:0},c=[];function u(r){if(o[r])return o[r].exports;var t=o[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.m=e,u.c=o,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)u.d(t,o,function(r){return e[r]}.bind(null,o));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/fcc-challenges/pomodoro-clock-react/build/";var l=this["webpackJsonppomodoro-clock-react"]=this["webpackJsonppomodoro-clock-react"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var p=0;p<l.length;p++)r(l[p]);var f=a;t()}([])</script><script src="/fcc-challenges/pomodoro-clock-react/build/static/js/2.8e985427.chunk.js"></script><script src="/fcc-challenges/pomodoro-clock-react/build/static/js/main.fc7ef8c4.chunk.js"></script></body></html>
|
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="#"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/fcc-challenges/pomodoro-clock-react/build/logo192.png"/><link rel="manifest" href="/fcc-challenges/pomodoro-clock-react/build/manifest.json"/><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400&display=swap"><title>Pomodoro Clock React - Build a Pomodoro Clock - Front End Libraries Projects</title><link href="/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"><div><script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script></div></div><script>!function(e){function r(r){for(var o,u,l=r[0],a=r[1],p=r[2],i=0,s=[];i<l.length;i++)u=l[i],Object.prototype.hasOwnProperty.call(n,u)&&n[u]&&s.push(n[u][0]),n[u]=0;for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o]);for(f&&f(r);s.length;)s.shift()();return c.push.apply(c,p||[]),t()}function t(){for(var e,r=0;r<c.length;r++){for(var t=c[r],o=!0,l=1;l<t.length;l++){var a=t[l];0!==n[a]&&(o=!1)}o&&(c.splice(r--,1),e=u(u.s=t[0]))}return e}var o={},n={1:0},c=[];function u(r){if(o[r])return o[r].exports;var t=o[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.m=e,u.c=o,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)u.d(t,o,function(r){return e[r]}.bind(null,o));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/fcc-challenges/pomodoro-clock-react/build/";var l=this["webpackJsonppomodoro-clock-react"]=this["webpackJsonppomodoro-clock-react"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var p=0;p<l.length;p++)r(l[p]);var f=a;t()}([])</script><script src="/fcc-challenges/pomodoro-clock-react/build/static/js/2.a6220f55.chunk.js"></script><script src="/fcc-challenges/pomodoro-clock-react/build/static/js/main.56d846f0.chunk.js"></script></body></html>
|
@ -1,23 +1,23 @@
|
|||||||
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
||||||
{
|
{
|
||||||
"revision": "d082d68a5399586ec58ce57a803ad208",
|
"revision": "cafb8c1b297ca5855a25f6bbc1d61de6",
|
||||||
"url": "/fcc-challenges/pomodoro-clock-react/build/index.html"
|
"url": "/fcc-challenges/pomodoro-clock-react/build/index.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "e840ec85f934321d80d6",
|
"revision": "18588698f155892ce8d1",
|
||||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css"
|
"url": "/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "f6e963889a1cdeb20ac3",
|
"revision": "955c972470b036699bb7",
|
||||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.8e985427.chunk.js"
|
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.a6220f55.chunk.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "c64c486544348f10a6d6c716950bc223",
|
"revision": "c64c486544348f10a6d6c716950bc223",
|
||||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.8e985427.chunk.js.LICENSE.txt"
|
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.a6220f55.chunk.js.LICENSE.txt"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "e840ec85f934321d80d6",
|
"revision": "18588698f155892ce8d1",
|
||||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/main.fc7ef8c4.chunk.js"
|
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/main.56d846f0.chunk.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "8cfbad2a32123298c100",
|
"revision": "8cfbad2a32123298c100",
|
@ -14,7 +14,7 @@
|
|||||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||||
|
|
||||||
importScripts(
|
importScripts(
|
||||||
"/fcc-challenges/pomodoro-clock-react/build/precache-manifest.e6fd82d65a64f9d87202c6dab0d433f6.js"
|
"/fcc-challenges/pomodoro-clock-react/build/precache-manifest.26aca98821ee4880d329b4892a380648.js"
|
||||||
);
|
);
|
||||||
|
|
||||||
self.addEventListener('message', (event) => {
|
self.addEventListener('message', (event) => {
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5
pomodoro-clock-react/package-lock.json
generated
5
pomodoro-clock-react/package-lock.json
generated
@ -8562,6 +8562,11 @@
|
|||||||
"sort-keys": "^1.0.0"
|
"sort-keys": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nosleep.js": {
|
||||||
|
"version": "0.11.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.11.0.tgz",
|
||||||
|
"integrity": "sha512-Ewb7YpPJ6t1IAiMoXM5vWBMomqVFD0wUXXzUfE+kGftXxXFXqLPV3Aq6Iggxxm568tMVptrlXLw5BPMzEgOK6A=="
|
||||||
|
},
|
||||||
"npm-run-path": {
|
"npm-run-path": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"@testing-library/jest-dom": "^4.2.4",
|
"@testing-library/jest-dom": "^4.2.4",
|
||||||
"@testing-library/react": "^9.5.0",
|
"@testing-library/react": "^9.5.0",
|
||||||
"@testing-library/user-event": "^7.2.1",
|
"@testing-library/user-event": "^7.2.1",
|
||||||
|
"nosleep.js": "^0.11.0",
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
"react-redux": "^7.2.0",
|
"react-redux": "^7.2.0",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import NoSleep from 'nosleep.js';
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
@ -34,6 +35,7 @@ class Controls extends React.Component {
|
|||||||
this.handleMouseEventReset = this.handleMouseEventReset.bind(this);
|
this.handleMouseEventReset = this.handleMouseEventReset.bind(this);
|
||||||
this.handlePlay = this.handlePlay.bind(this);
|
this.handlePlay = this.handlePlay.bind(this);
|
||||||
this.handleReset = this.handleReset.bind(this);
|
this.handleReset = this.handleReset.bind(this);
|
||||||
|
this.handleNoSleep = this.handleNoSleep.bind(this);
|
||||||
this.state = {
|
this.state = {
|
||||||
playColor: colors.ivoryBlack,
|
playColor: colors.ivoryBlack,
|
||||||
pauseColor: colors.ivoryBlack,
|
pauseColor: colors.ivoryBlack,
|
||||||
@ -42,11 +44,26 @@ class Controls extends React.Component {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleNoSleep() {
|
||||||
|
if (navigator.userAgent.includes('Mobile')) {
|
||||||
|
const self = this;
|
||||||
|
var noSleep = new NoSleep();
|
||||||
|
noSleep.enable();
|
||||||
|
let refreshNoSleep = setInterval(function() {
|
||||||
|
if (!self.props.clockIsRunning) {
|
||||||
|
noSleep.disable();
|
||||||
|
clearInterval(refreshNoSleep);
|
||||||
|
}
|
||||||
|
},5000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
handlePlay() {
|
handlePlay() {
|
||||||
if (this.props.clockIsRunning) {
|
if (this.props.clockIsRunning) {
|
||||||
this.props.clockIsRunningAction(false);
|
this.props.clockIsRunningAction(false);
|
||||||
} else {
|
} else {
|
||||||
this.props.clockIsRunningAction(true);
|
this.props.clockIsRunningAction(true);
|
||||||
|
this.handleNoSleep();
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const nowSeconds = Math.floor(now.getTime() / 1000);
|
const nowSeconds = Math.floor(now.getTime() / 1000);
|
||||||
const remainingTime = this.props.clock.split(':');
|
const remainingTime = this.props.clock.split(':');
|
||||||
|
Loading…
Reference in New Issue
Block a user