dashboard widget minimal event init


/ Published in: JavaScript
Save to your folder(s)

http://developer.apple.com/jp/documentation/AppleApplications/Conceptual/Dashboard_Tutorial/index.html?http://developer.apple.com/jp/documentation/AppleApplications/Conceptual/Dashboard_Tutorial/Events/chapter_6_section_3.html


Copy this code and paste it in your HTML
  1. if (window.widget)
  2. {
  3. widget.onshow = onshow;
  4. widget.onhide = onhide;
  5. }
  6.  
  7. function onshow () {
  8. if (timer == null) {
  9. updateTime();
  10. timer = setInterval("updateTime();", 1000);
  11. }
  12. }
  13.  
  14. function onhide () {
  15. if (timer != null) {
  16. clearInterval(timer);
  17. timer = null;
  18. }
  19. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.