Clock update instantly + slower interval
This commit is contained in:
parent
042f5f6b18
commit
bdeaa9a561
1 changed files with 8 additions and 5 deletions
|
@ -14,12 +14,15 @@ export default class Clock extends Vue {
|
|||
@Prop()
|
||||
public format!: string;
|
||||
|
||||
private update(): void {
|
||||
this.formatted = DateTime.now()
|
||||
.setLocale(navigator.language)
|
||||
.toFormat(this.format);
|
||||
}
|
||||
|
||||
public created(): void {
|
||||
this.interval = setInterval((): void => {
|
||||
this.formatted = DateTime.now()
|
||||
.setLocale(navigator.language)
|
||||
.toFormat(this.format);
|
||||
}, 1000);
|
||||
this.update();
|
||||
this.interval = setInterval(this.update, 10000);
|
||||
}
|
||||
|
||||
public beforeDestroy(): void {
|
||||
|
|
Loading…
Reference in a new issue