We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

ringo on 07/16/06


Tagged

onshow onhide dashboard widget


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

fantomex


dashboard widget minimal event init


Published in: JavaScript 


http://developer.apple.com/jp/documentation/AppleApplications/Conceptual/DashboardTutorial/index.html?http://developer.apple.com/jp/documentation/AppleApplications/Conceptual/DashboardTutorial/Events/chapter6section_3.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 

You need to login to post a comment.