Comments (22)
On second (sober) thought, rather than put the pref in the .TimeCircles()
instantiation, it should be in the instantiation of the callback function.
from timecircles.
Seconds is always being shown (in the "total" attribute), You're absolutely right about the callback needing to be triggered for units that are not shown. Should be a relatively easy fix.
from timecircles.
You're right that it's included as total
but the problem is it remains static at 119 for the entire period between 120 and 60 when seconds is set to show:false
. If you could make an active value available, that would be excellent!
from timecircles.
I'm making it so it will trigger the callback for units not being shown.
from timecircles.
This might actually be more difficult than I had hoped, because the value of units not shown / shown are a bit errr... Strange? The reason is that, when you show hours, hide minutes, show seconds, then seconds goes up to 3600 instead of 60 (since there's 3600 seconds in an hour).
So, I'm not sure which values to throw into the listeners right now. One thing I am noticing so far is that everyone is using the "total" value almost exclusively (and understandably so).
from timecircles.
Is there a reason for sending anything but seconds to the callback? I know it's a pain to break backwards compatibility, but a standard unit would really make it simpler.
from timecircles.
The intent was that you could do something like:
$("#timer").TimeCircles().addListener(function(unit, value, total) {
if(unit === "Hours") $("ClockHourSound").play();
});
But truthfully you could do the same with: if(total % 3600 == 0)
, true it would get a little bit more complex to get the current number of hours, but that's not a major issue. That could be a request / call.
At this point I'm not entirely sure if I should change it or not. I'll need a little while to figure out if I can think of an elegant fix.
from timecircles.
I've put out a new release, version https://github.com/wimbarelds/TimeCircles/releases/tag/1.1.0
It resolves this issue by adding a new parameter to .addListener()
. You can use it as follows:
function callbackFunction(unit, value, total){
// Your code here
}
$("#timer").TimeCircles().addListener(callbackFunction, "all");
Please let me know if this new release has what you're looking for and allows you to do what you want. For now I will close this, but please re-open it if you still have problems.
from timecircles.
I'll give it a shot and let you know how it goes, thanks for this!
from timecircles.
I'm not getting anything now, neither 1.1.0 or 1.1.1 are displaying anything now, and I'm not getting any debug info in firebug either :( I've reduced the complexity right down to a pretty basic call:
var idle_timer = $('div#idle_timer');
if (idle_timer.TimeCircles != null) { idle_timer.TimeCircles().destroy(); }
idle_timer.data('timer',1800);
idle_timer.TimeCircles({ time: { Days: { show:false }, Hours: { show:false }, Minutes: { color: '#FFF' }, Seconds: { color: '#FFF' } }, circle_bg_color: '#4D8DC1' });
In 1.0.5 I'm at least seeing the two circles (although they're counting up and not seeing the dynamically added data-timer
attribute, I'm guessing I was probably drawing from the master as you were committing and the support didn't go back that far maybe?), but as soon as I replace with either 1.1.0 or 1.1.1, I'm getting nothing, no circles, no errors, no debug info.
Any ideas?
from timecircles.
BTW, I can't reopen the issue, doesn't seem I've got access anymore, did you tighten things down?
from timecircles.
Nope. I didn't tighten it down. It looks like the .destroy line is causing problems, I'm looking at why.
from timecircles.
Ok, not sure why I can't re-open, but option is no longer there. In any case, I tried commenting out the .destroy()
line and it had no effect.
from timecircles.
Hmmm, strike that, thought I'd cleared the cache but apparently not, the .destroy()
commented out brought it back this time.
from timecircles.
I see the problem.
I used .attr("data-tc-id", cur_id)
instead of .data('tc-id', cur_id)
. However upon destroy it should remove the tc-id. I'd not changed it to remove the attribute instead of the data, so it thought there was still something there.
See 21b7212 for the fix.
from timecircles.
Doesn't seem to have worked for me. As long as I include that check and destroy in place, it's not displaying anything, and not providing any error to debug from. Trying some different stuff, and will let you know if I find anything, but I may have to fall back on manually removing the elements themselves for the time being, haven't gotten to the point where I can actually test the "all" feature you added above.
from timecircles.
Can you give me a url where I can see this? Because I tested it locally and it solved the problem.
from timecircles.
I'm creating another demo and will make it available shortly, I've run into another issue. I temporarily added something that manually kills the children of my main container rather than using destroy, which finally let me test the "all" functionality, and I'm afraid that somewhere in there I'm experiencing a major memory leak now, my memory usage for Firefox jumps from about 700mb on average, up and down every couple seconds, adding about 200mb each time, and finally crashing it at around 2500mb usage. This obviously has something to do with how I've nested the 4 tiers however this wasn't something I was experiencing before.
from timecircles.
If you do not destroy the instance, but do remove the elements- then yes there will probably be a memory leak. But that's not wrong, because you're creating a dozen instances without removing old ones properly.
from timecircles.
Wasn't doing that in earlier builds, but maybe I just didn't notice or it wasn't as severe, I'd just assumed that the events tied to an element would be referentially destroyed but if not, so be it, that explains that.
from timecircles.
Looks like I've found out why it wasn't properly working. I was setting $("#idle_timer").attr("data-tc-id", id)
, and also removing it. However, I was also trying to read it with .data('tc-id')
which makes it a data attribute as well as an html attribute. So now I removeAttr()
as well as removeData()
on it, and it works. If this works, please let me know and I'll push a new version. 9dcca68
from timecircles.
Since you haven't replied, I assume that it's working. I'm going to push the new version now.
from timecircles.
Related Issues (20)
- Call a angular function from a timecircle listener
- timecircles cancels a timeout set outside of it
- Counter Clockwise change second color
- How to change the color of canvas during the counterclockwise
- Can not initialize plugin in Bootstrap 4 modal popup
- Text label for when the date/hour/minutes reach singular state
- Circle direction rtl HOT 1
- Radialfade function
- timecircles is not a function HOT 3
- Cpu Performance
- Customized outer and round progress bars
- Start-time from server HOT 2
- Change of color of the text HOT 1
- How to make counter not reset on page refresh
- After changing data-date="2011-01-01 00:00:00" dynamically, how to start timer again with this new updated date. HOT 1
- How to change timecircle to square
- More than 60 minutes countdown HOT 2
- center
- Circle Background Color Option Doesn't Work
- Site Not loading
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timecircles.