Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
teddi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
teddi
Commits
8610a80e
Commit
8610a80e
authored
Nov 12, 2020
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
d0e514e0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
38 deletions
+33
-38
Countdown.d.ts
dist/Countdown.d.ts
+12
-13
Countdown.js
dist/Countdown.js
+4
-8
package.json
package.json
+1
-1
Countdown.ts
src/Countdown.ts
+16
-16
No files found.
dist/Countdown.d.ts
View file @
8610a80e
import
EventEmitter
from
"./EventEmitter"
;
export
default
class
Countdown
extends
EventEmitter
<
any
>
{
_timer
:
any
;
_text
:
any
;
_seconds
:
any
;
_format
:
any
;
_counter
:
any
;
_delay
:
an
y
;
_running
:
boolean
;
private
_timer
;
private
_text
;
private
_seconds
;
private
_format
;
private
_counter
;
private
_dela
y
;
private
_running
;
constructor
(
text
:
any
,
seconds
:
any
,
format
:
any
,
delay
:
any
);
getCountdown
():
string
|
undefined
;
getHHMMSS
():
string
;
getMMSS
():
string
;
getText
():
any
;
private
getCountdown
;
private
getHHMMSS
;
private
getMMSS
;
private
getText
;
start
():
void
;
stop
():
void
;
private
stop
;
reset
(
$seconds
:
number
):
void
;
set
seconds
(
val
:
number
);
get
running
():
boolean
;
}
dist/Countdown.js
View file @
8610a80e
...
...
@@ -70,16 +70,12 @@ var Countdown = /** @class */ (function (_super) {
this
.
emit
(
"complete"
);
};
Countdown
.
prototype
.
reset
=
function
(
$seconds
)
{
this
.
seconds
=
$seconds
;
this
.
_
seconds
=
$seconds
;
};
Object
.
defineProperty
(
Countdown
.
prototype
,
"seconds"
,
{
set
:
function
(
val
)
{
this
.
_seconds
=
val
;
},
enumerable
:
false
,
configurable
:
true
});
Object
.
defineProperty
(
Countdown
.
prototype
,
"running"
,
{
// set seconds(val: number) {
// this._seconds = val;
// }
get
:
function
()
{
return
this
.
_running
;
},
...
...
package.json
View file @
8610a80e
{
"name"
:
"teddi"
,
"version"
:
"1.0.
4
"
,
"version"
:
"1.0.
5
"
,
"description"
:
""
,
"main"
:
"dist/index.js"
,
"types"
:
"dist/index.d.ts"
,
...
...
src/Countdown.ts
View file @
8610a80e
...
...
@@ -5,13 +5,13 @@ function getNum(n: any) {
}
export
default
class
Countdown
extends
EventEmitter
<
any
>
{
_timer
:
any
;
_text
:
any
;
_seconds
:
any
;
_format
:
any
;
_counter
:
any
;
_delay
:
any
;
_running
=
false
;
private
_timer
:
any
;
private
_text
:
any
;
private
_seconds
:
any
;
private
_format
:
any
;
private
_counter
:
any
;
private
_delay
:
any
;
private
_running
=
false
;
constructor
(
text
:
any
,
seconds
:
any
,
format
:
any
,
delay
:
any
)
{
super
();
console
.
log
(
this
);
...
...
@@ -22,12 +22,12 @@ export default class Countdown extends EventEmitter<any> {
this
.
_delay
=
delay
||
1000
;
}
getCountdown
()
{
private
getCountdown
()
{
if
(
this
.
_format
==
"hhmmss"
)
return
this
.
getHHMMSS
();
if
(
this
.
_format
==
"mmss"
)
return
this
.
getMMSS
();
}
getHHMMSS
()
{
private
getHHMMSS
()
{
const
left
=
this
.
_seconds
-
this
.
_counter
;
const
hours
=
Math
.
floor
(
left
/
3600
);
const
minutes
=
Math
.
floor
((
left
%
3600
)
/
60
);
...
...
@@ -35,14 +35,14 @@ export default class Countdown extends EventEmitter<any> {
return
`
${
getNum
(
hours
)}
:
${
getNum
(
minutes
)}
:
${
getNum
(
seconds
)}
`
;
}
getMMSS
()
{
private
getMMSS
()
{
const
left
=
this
.
_seconds
-
this
.
_counter
;
const
minutes
=
Math
.
floor
(
left
/
60
);
const
seconds
=
left
%
60
;
return
`
${
getNum
(
minutes
)}
:
${
getNum
(
seconds
)}
`
;
}
getText
()
{
private
getText
()
{
return
this
.
_text
.
replace
(
"{0}"
,
this
.
getCountdown
());
}
...
...
@@ -58,19 +58,19 @@ export default class Countdown extends EventEmitter<any> {
},
this
.
_delay
);
}
stop
()
{
private
stop
()
{
this
.
_running
=
false
;
clearInterval
(
this
.
_timer
);
this
.
emit
(
"complete"
);
}
reset
(
$seconds
:
number
)
{
this
.
seconds
=
$seconds
;
this
.
_
seconds
=
$seconds
;
}
set
seconds
(
val
:
number
)
{
this
.
_seconds
=
val
;
}
//
set seconds(val: number) {
//
this._seconds = val;
//
}
get
running
()
{
return
this
.
_running
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment