javascript - why the check on e ? and where is it being passed from? -


hey guys going through code of carasoul.js , came across following function .

  carousel.prototype.cycle = function (e) {      e || (this.paused = false)      this.interval && clearinterval(this.interval)      this.options.interval       && !this.paused       && (this.interval = setinterval($.proxy(this.next, this), this.options.interval))      return   } 

can tell me why check on e in 1st line of function ? have seen in of bootstrap plugins . can explain significance of check ? , e being passed ??

the 2 things found out cycle get's called function plugin , on line 186 , e if console logged gives following output :

object { originalevent: mouseover, type: "mouseover", isdefaultprevented: bb(), timestamp: 0, jquery1112044026608114512766: true, toelement: undefined, screeny: 407, screenx: 643, pagey: 310, pagex: 643, 23 more… }  

the entire plugin can here.

edit :: asking "why" , not "what e" , question more contextual , relates code convention of popular framework,(bootstrap3.2+) , not asking beginner question how ?

thank .

alex-z

the function cycle being called in 3 different forms:

  • cycle()
  • cycle(true)
  • as event handler mouseleave. e therefor event parameter.

with check first call can distinguished other 2 calls. information if carousel in pause-mode can transmitted if can not set parameters (event).


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -