From 63628c024592b957e5c3336b881109f82dd6d28d Mon Sep 17 00:00:00 2001 From: Adekunle Ogunade Date: Thu, 13 Feb 2020 23:44:05 +0000 Subject: [PATCH] animation and timeout --- babel.config.js | 6 ++-- package.json | 4 ++- src/components/HelloWorld.vue | 9 +++++- src/components/Whoosh/Card.vue | 52 ++++++++++++++++++++++++++++++-- src/components/Whoosh/Util.js | 22 ++++++++++++++ src/components/Whoosh/Whoosh.vue | 49 +++++++++++++++++++++++++++--- 6 files changed, 130 insertions(+), 12 deletions(-) create mode 100644 src/components/Whoosh/Util.js diff --git a/babel.config.js b/babel.config.js index cf940d0..e6dd71a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -14,8 +14,10 @@ module.exports = { } }] ], - "plugins": ["@babel/plugin-transform-runtime"] + "plugins": ["@babel/plugin-transform-runtime",{ + "regenerator": true + }] } }, - "plugins": ["@babel/plugin-syntax-dynamic-import", "transform-dynamic-import"] + "plugins": ["@babel/plugin-syntax-dynamic-import", "transform-dynamic-import","@babel/plugin-transform-runtime"] } \ No newline at end of file diff --git a/package.json b/package.json index 4f4be84..b7ad795 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,9 @@ "parserOptions": { "parser": "babel-eslint" }, - "rules": {} + "rules": { + "no-unused-vars":"off" + } }, "browserslist": [ "> 1%", diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index ce30c70..764bb82 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -1,6 +1,6 @@ @@ -11,6 +11,13 @@ export default { components: { Card }, props: { msg: String + }, + data(){ + return{ + content:{title:"My name is "+this.id, + message:"This is my message " + } + } } } diff --git a/src/components/Whoosh/Card.vue b/src/components/Whoosh/Card.vue index 3ad8ac9..68830fc 100644 --- a/src/components/Whoosh/Card.vue +++ b/src/components/Whoosh/Card.vue @@ -1,19 +1,30 @@ + @@ -37,8 +83,8 @@ export default { } .card__status { background-color: green; - width: 95%; - height: 10px; + width: 10px; + height: 190px; border-radius: 20px; } diff --git a/src/components/Whoosh/Util.js b/src/components/Whoosh/Util.js new file mode 100644 index 0000000..cbb3f73 --- /dev/null +++ b/src/components/Whoosh/Util.js @@ -0,0 +1,22 @@ +export const generateId = (i => () => i++)(0) + + + +export class TimerCup { + constructor(fn, countdown) { + let timerId, start, remaining = countdown; + this.cancel = function () { + window.clearTimeout(timerId); + }; + this.pause = function () { + window.clearTimeout(timerId); + remaining -= Date.now() - start; + }; + this.resume = function () { + start = Date.now(); + window.clearTimeout(timerId); + timerId = window.setTimeout(fn, remaining); + }; + this.resume(); + } +} diff --git a/src/components/Whoosh/Whoosh.vue b/src/components/Whoosh/Whoosh.vue index d19f508..1f1a5e3 100644 --- a/src/components/Whoosh/Whoosh.vue +++ b/src/components/Whoosh/Whoosh.vue @@ -1,23 +1,29 @@ \ No newline at end of file + + + \ No newline at end of file