-
look at the constructor and note its 3 primary parts:
- a callback function binding section
- a property parameter storing section
- an initial state section
-
create the render function prameters: none returns: a jquery dom object purpose: 1. recreates the following dom structure
<div class="cardContainer"> <div class="card"> <div class="front" style="background-image: url(images/donald1.jpg);"></div> <div class="back" style="background-image: url(images/disneylogo.jpg);"></div> </div> </div>
- stores the dom structure into this object's state
- adds a click handler to the outermost dom element that links to this object's handleClick
- adds a background image to the front face dom element with the frontImage from the data stored in this object's state
- adds a background image to the back face dom element with the backImage from the data stored in this object's state
- returns the outermost dom element that contains the rest of the dom elements
-
handleClick
- parameters: none
- returns: none
- purpose:
- calls this object's clickCallback function and passes to it the argument of this object
-
revealFront
- parameters: none
- returns: none
- purpose:
- takes this object's backface dom element and hides it
-
revealBack
- parameters: none
- returns: none
- purpose:
- takes this object's backface dom element and shows it
-
getID
- parameters: none
- returns: this object's id
- purpose:
- returns this object's ID, which it got when it was constructed
-
playSound
- parameters: (string) key
- returns: none
- purpose:
- checks in this object's sounds object, which it received when it was constructed
- looks for the key parameter
- if it finds the key in the object, it grabs the string there as a URL
- instantiates an Audio object
- adds a oncanplaythrough function that
- selects the Audio object and calls the play method
- adds a oncanplaythrough function that
ra1990 / memory_match_oop Goto Github PK
View Code? Open in Web Editor NEWThis project forked from dpaschal-lf/memory_match_oop