Last active
August 31, 2017 16:14
Revisions
-
jecfish revised this gist
Aug 31, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export class MyCards extends GestureEventListeners(PolymerElement) { static get properties() { return { cards: Array }; } -
jecfish revised this gist
Aug 31, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export class MyCards extends GestureEventListeners(PolymerElement) { } private isMatch([image1, image2]: string[]) { // logic to check if two card images matched } flip({ model }) { -
jecfish created this gist
Aug 31, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ // index.ts import { Element as PolymerElement } from '@polymer/polymer/polymer-element'; import '@polymer/polymer/lib/elements/dom-repeat'; import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners'; import * as view from './cards.template.html'; export class MyCards extends GestureEventListeners(PolymerElement) { static get template() { return view; } constructor() { super(); } static get properties() { return { cards: [] }; } getClass(item) { return (item.isFlipped || item.isMatched) ? 'card flipped' : 'card'; } cards: PolyTest.Card[]; private get isReachMaxFlippedCard() { // logic to check max 2 cards flip at any point of time } private get isAllCardsMatched() { // logic to check if all cards matched } private isMatch([image1, image2]: string[]) { return image1 === image2; } flip({ model }) { const card = { ...model.item }; const index = model.index; // logic to flip the card } }