MiniMemory

MiniMemory

Main container of the game. Will be used as {CustomElements.define} constructor.

Constructor

new MiniMemory()

of the game.

Source:
Author:

of the game. Will be used as {CustomElements.define} constructor.

Example
customElements.define('mini-memory', MiniMemory);
// Create MiniMemory DOMElement like this :
document.createElement('mini-memory');
// or like this:
<mini-memory></mini-memory>

Extends

  • HTMLElement

Classes

MiniMemory
of the game.

Members

toolbar

HTMLDivElement information bar on top of the screen.

Source:

settings

Controls and keep track of game settings Settings.

Source:

layers

handle of all layers such as loading, toolbar, setting etc. which will be defined when they are created.

Source:

cardBack

Image of the closed card drawn to be conatiner canvas

Source:

(static) observedAttributes

Necessary attributes to be watched.

Source:

Methods

reset()

Resets all parameters to enable a clean restart/render.

Source:

connectedCallback()

Callback on custom element included in DOM.

Source:

disconnectedCallback()

Callback function on removing of custom element from DOM.

Source:

adoptedCallback()

Callback function on adding of custom element to another DOM.

Source:

attributeChangedCallback(name, oldVal, newVal)

callback function on attribute change of custom element.

Source:

callback function on attribute change of custom element.

Parameters:
Name Type Description
name string

Name of the attribute.

oldVal string

Latest value before change.

newVal string

The current value to be set.

checkDefaultAttributes() → {boolean}

check if element has manadatory fields defined or not.

Source:
Returns:

Returns true if minimum requirements are correctly defined.

Type
boolean

prepareMatrix()

Prepare cards layout using given matrix attribute.

Source:

myAttributes() → {object}

Gets current attributes according to observedAttributes.

Source:

Gets current attributes according to observedAttributes.

Returns:

attr Obeserved values object.

Type
object

render()

Renders custom element with initial attributes.

Source: