This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # configure a pipe rule | |
| sudo ipfw pipe 1 config bw 512Kbit/s delay 500ms | |
| # add the pipe to connection in and out port 80 | |
| sudo ipfw add 1 pipe 1 src-port 80 | |
| sudo ipfw add 2 pipe 1 dst-port 80 | |
| # remove the rules and delete the pipe | |
| sudo ipfw delete 1 | |
| sudo ipfw delete 2 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | drawFrame: function(){ | |
| window.requestAnimationFrame(this.drawFrame, this.canvas); | |
| this.render(); | |
| }, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | checkCanvasSupport: function(){ | |
| if(!document.createElement('canvas').getContext) { | |
| alert("This browser dosn't support the canvas element"); | |
| return false; | |
| }else{ | |
| console.log("success!"); | |
| return true; | |
| } | |
| }, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | neutralizeAnimationFunc: function(){ | |
| if(!window.requestAnimationFrame){ | |
| window.requestAnimationFrame = (window.webkitRequestAnimationFrame || | |
| window.mozRequestAnimationFrame || | |
| window.oRequestAnimationFrame || | |
| window.msRequestAnimationFrame || | |
| function(callback){ | |
| return window.setTimeout(callback, 1000/60); | |
| }); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | addMouseEvents: function (){ | |
| this.canvas.addEventListener('mousedown', function(event){ | |
| console.log("mouse down"); | |
| }, false); | |
| this.canvas.addEventListener('mouseup', function(event){ | |
| console.log("mouse up"); | |
| }, false); | |
| } | 
NewerOlder