Friday 19 April 2013

An Example of Object Oriented in JavaScript

Below is an example of implementing object oriented in JavaScript:
var AutoRefresh = {
  counter : 0,
  timesDuration : 5,
  timerId : null,
  autoRefreshIsRunning : false,
  runProcess : function() {
        AutoRefresh.counter++;
        AutoRefresh.autoRefreshIsRunning = true;
        . . .
  },
  stopProcess : function() {      
        AutoRefresh.counter = 0;
        AutoRefresh.autoRefreshIsRunning = false;
        . . .
  }
};

No comments: