diff --git a/src/app.js b/src/app.js index 671966d..1fae0d7 100644 --- a/src/app.js +++ b/src/app.js @@ -1,11 +1,13 @@ -import { $ } from 'dollr/dollr' +import { $ } from 'dollr' + +import './process' import Timer from './components/Timer' // request permission on page load document.addEventListener('DOMContentLoaded', () => { if (!Notification) { - alert('Desktop notifications not available in your browser. Try Chromium.') + alert('Desktop notifications not available in your browser. Try Chromium, Chrome or Firefox.') return } diff --git a/src/components/Timer/index.js b/src/components/Timer/index.js index d5b0ffd..7c5b6b2 100644 --- a/src/components/Timer/index.js +++ b/src/components/Timer/index.js @@ -1,5 +1,5 @@ import markoWidgets from 'marko-widgets' -import template from './template.marko' +import template from './template.marko.js' import timeFilter from '../../util/time-filter' diff --git a/src/master.marko b/src/master.marko index c0c443d..95f6352 100644 --- a/src/master.marko +++ b/src/master.marko @@ -23,7 +23,7 @@

Pomodoro Time!

- +
diff --git a/src/process.js b/src/process.js new file mode 100644 index 0000000..52f3b4b --- /dev/null +++ b/src/process.js @@ -0,0 +1,7 @@ +window.process = { + browser: true, + env: {}, + nextTick: (fnc) => { + setTimeout(fnc) + } +} diff --git a/src/util/split-time.js b/src/util/split-time.js index 0249b5a..5ec196f 100644 --- a/src/util/split-time.js +++ b/src/util/split-time.js @@ -1,19 +1,17 @@ -'use strict'; +const divs = [ 60, 100, 10 ] -const divs = [ 60, 100, 10 ]; - -module.exports = function (time) { - const arr = []; +export default function (time) { + const arr = [] for (let i = 0; i < divs.length; i++) { - const nbr = divs.slice(i).reduce((a, b) => a * b); + const nbr = divs.slice(i).reduce((a, b) => a * b) - const result = Math.floor(time / nbr); + const result = Math.floor(time / nbr) - arr.push(result); + arr.push(result) - time = time - result * nbr; - //this.timerElements[i].textContent = result; + time = time - result * nbr + //this.timerElements[i].textContent = result } - return arr; -}; + return arr +} diff --git a/src/util/time-filter.js b/src/util/time-filter.js index 94b89f1..eb6e67f 100644 --- a/src/util/time-filter.js +++ b/src/util/time-filter.js @@ -1,10 +1,8 @@ -'use strict'; +import splitTime from './split-time' +import twoDigits from './two-digits' -const splitTime = require('./split-time'); -const twoDigits = require('./two-digits'); +export default function (time) { + const arr = splitTime(time).map(twoDigits) -module.exports = function (time) { - const arr = splitTime(time).map(twoDigits); - - return arr.join(':'); -}; + return arr.join(':') +} diff --git a/src/util/two-digits.js b/src/util/two-digits.js index b7cf451..b8500b6 100644 --- a/src/util/two-digits.js +++ b/src/util/two-digits.js @@ -1,5 +1,3 @@ -'use strict'; - -module.exports = function twoDigits(val) { - return val >= 10 ? val : '0' + val; -}; +export default function twoDigits(val) { + return val >= 10 ? val : '0' + val +}