GithubHelp home page GithubHelp logo

memory_match_oop's Introduction

memory_match_oop

card.js

  1. look at the constructor and note its 3 primary parts:

    1. a callback function binding section
    2. a property parameter storing section
    3. an initial state section
  2. 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>
    
    1. stores the dom structure into this object's state
    2. adds a click handler to the outermost dom element that links to this object's handleClick
    3. adds a background image to the front face dom element with the frontImage from the data stored in this object's state
    4. adds a background image to the back face dom element with the backImage from the data stored in this object's state
    5. returns the outermost dom element that contains the rest of the dom elements
  3. handleClick

    • parameters: none
    • returns: none
    • purpose:
      1. calls this object's clickCallback function and passes to it the argument of this object
  4. revealFront

    • parameters: none
    • returns: none
    • purpose:
      1. takes this object's backface dom element and hides it
  5. revealBack

    • parameters: none
    • returns: none
    • purpose:
      1. takes this object's backface dom element and shows it
  6. getID

    • parameters: none
    • returns: this object's id
    • purpose:
      1. returns this object's ID, which it got when it was constructed
  7. playSound

    • parameters: (string) key
    • returns: none
    • purpose:
    1. checks in this object's sounds object, which it received when it was constructed
      1. looks for the key parameter
      2. if it finds the key in the object, it grabs the string there as a URL
      3. instantiates an Audio object
        1. adds a oncanplaythrough function that
          1. selects the Audio object and calls the play method

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.