MCPcopy Create free account
hub / github.com/HeyHeyChicken/No-Clock / loop

Function loop

public/js/script.js:643–707  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

641 },
642 methods: {
643 loop() {
644 if (this.oldTime != this.getCurrentTime()) {
645 this.initDateGrid();
646 this.showCalendar(1, 6);
647 this.writeTime(
648 this.time_show_seconds ? 11 : 16,
649 7,
650 this.time_show_seconds
651 );
652 this.writeDay(11, 13, this.monday_is_first_day);
653 }
654
655 if (this.notification.remaining_time > 0) {
656 this.initNotificationGrid();
657 if (this.notification.icon.value != null) {
658 if (this.notification.initial_remaining_time == undefined) {
659 this.notification.initial_remaining_time =
660 this.notification.remaining_time;
661 }
662 let icon = DICTIONNARY[this.notification.icon.value];
663 if (!icon) {
664 icon = DICTIONNARY["empty"];
665 }
666
667 let second =
668 (this.notification.initial_remaining_time * 1000 -
669 Math.floor(this.notification.remaining_time * 1000)) %
670 icon.duration();
671 let iterator = 0;
672 let frame = 0;
673 for (let i = 0; i < icon.frames.length; i++) {
674 if (
675 second >= iterator &&
676 second < iterator + icon.frames[i].duration
677 ) {
678 frame = i;
679 break;
680 }
681 iterator += icon.frames[i].duration;
682 }
683
684 this.notification_grid = this.mergeGrids(
685 this.notification_grid,
686 icon.frames[frame].grid,
687 this.notification.icon.x,
688 this.notification.icon.y
689 );
690 }
691 this.notification_grid = this.writeWord(
692 this.notification_grid,
693 this.notification.message.value,
694 this.notification.message.x,
695 this.notification.message.y
696 );
697
698 this.notification.remaining_time -= this.loop_speed / 1000;
699 if (this.notification.remaining_time <= 0) {
700 this.initNotificationGrid();

Callers

nothing calls this directly

Calls 1

durationMethod · 0.80

Tested by

no test coverage detected