-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stop polling when module is hidden #9
Comments
Actually, please don't implement this. I live near the flight path for RDU. Planes go overhead frequently under 2000ft. I have hacked this module in the following ways to meet my needs:
if (!Array.isArray(d)) continue
if (d[11] == "RDU" || d[12] == "RDU") {
aircraft.push({
setTableData: function(data) {
if (!Array.isArray(data) || !data.length) {
this.hide(1000);
} else {
this.show(1000);
}
$("#flightsabove").tabulator("setData", data);
} End effect is that if I hear a plane, Magic Mirror tells me what the flight is. Otherwise it's hidden. If the polling stopped when hidden, it would never get un-hidden by new flight data. |
@ncmilhouse So just to make sure for me to understand what it does: Certainly seem more efficient to filter the radar results rather than the data/table results. The only problems with this as I can see are:
But perhaps we could consider adding the radar hack somehow... Possible work around implementation:
|
Wow, great hack there! I like the real name thing, but I decided not to use look into that (when I developed this), since it took up too much screen space on my portrait screen. But there are other way we could use it... There are 2 way to do PR's.
Unfortunately these two methods are not very compatible and creates huge headaches. |
No need to poll when the module is hidden. This functionality is controlled by two functions in the main module, according to:
suspend()
- When a module is hidden (using the module.hide() method), the suspend() method will be called. By subclassing this method you can perform tasks like halting the update timers.resume()
- When a module is requested to be shown (using the module.show() method), the resume() method will be called. By subclassing this method you can perform tasks restarting the update timers.We need to implement this functionality.
The text was updated successfully, but these errors were encountered: