Giter VIP home page Giter VIP logo

Comments (8)

Xitee1 avatar Xitee1 commented on August 15, 2024 1

That's correct, it doesn't need to check if it is lower than 9999.
But if the speed is below 0, it should be just ignored because everything below 0 is a static line which does not need to be updated and therefore the tablist would update each tick unnecessarily if the interval is set to 1.

from powerboard.

Xitee1 avatar Xitee1 commented on August 15, 2024 1

Sadly there seems to be no easy fix for this.
One way to reduce the unnecessary calls would be to split header and footer updates.
A better solution might be to cache the lines with the text already replaced with placeholders so it only needs to update/replace the placeholders that are actually needed.

from powerboard.

NicoNekoDev avatar NicoNekoDev commented on August 15, 2024

interval = Math.min(interval, speed);

The speed can be -1 and Math.min would return -1 which goes into the scheduler, and according to spigot documentation/source code, a scheduler with interval -1 would run once which is why the bug happening, and the refreshing doesn't work.
One simple way to fix it:
if (speed >= 0 && speed < 9999) { interval = Math.min(interval, speed); }

from powerboard.

Xitee1 avatar Xitee1 commented on August 15, 2024

Thanks @NicoNekoDev
This will not exactly fix the problem which is described in this issue (You probably didn't understand it correctly) but it will actually fix another problem that I didn't even think about.

from powerboard.

NicoNekoDev avatar NicoNekoDev commented on August 15, 2024

Okay, I was wrong. The actual fix it would be to set the interval to 1 if is lower than 1. Yeah, it fixes the refreshes not working on tablist.

from powerboard.

Xitee1 avatar Xitee1 commented on August 15, 2024

The actual fix it would be to set the interval to 1 if is lower than 1

No, the code that you've poseted is correct, because -1 is meant to disabling refreshing for that line

tablist.yml description:

If you have static scores (no animations or updates needed): Set the 'speed' value to '-1' or '9999'. Then the scheduler won't start to save performance.

from powerboard.

NicoNekoDev avatar NicoNekoDev commented on August 15, 2024

Yes, my code is correct, but after a bit of review, I came to conclusion that doing if (speed < 1) interval = 1 because:

  1. it doesn't go higher than the set interval (20 * 60)
  2. it only requires to not go bellow 1, not below or equal to 0

from powerboard.

Xitee1 avatar Xitee1 commented on August 15, 2024

However, I have changed the code and just made the startXXAnimation functions a boolean which returns if the scheduler has been started or not (It does not start, if the speed is below 0 or higher than 9999). If it has started it executes Math.min, otherwise it does not.
051bb83

from powerboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.