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 characters
| // Copy & paste this into browser console to play | |
| (function () { | |
| const winConditions = [ | |
| [0, 1, 2], | |
| [3, 4, 5], | |
| [6, 7, 8], | |
| [0, 3, 6], | |
| [1, 4, 7], | |
| [2, 5, 8], |
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 characters
| const catEndpoint = 'https://api.thecatapi.com/v1/images/search'; | |
| const wordsEndpoint = 'https://random-word-api.herokuapp.com/word?number=5' | |
| function checkStatus(res) { | |
| if (!res.ok) Promise.reject(new Error(res.statusText)); | |
| return Promise.resolve(res.json()); | |
| } | |
| const renderImage = (imgUrl) => { | |
| const wrapper = document.getElementById('image-wrapper'); |
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 characters
| const catEndpoint = 'https://api.thecatapi.com/v1/images/search'; | |
| const wordsEndpoint = 'https://random-word-api.herokuapp.com/word?number=5' | |
| function checkStatus(res) { | |
| if (!res.ok) Promise.reject(new Error(res.statusText)); | |
| return Promise.resolve(res.json()); | |
| } | |
| const renderImage = (imgUrl) => { | |
| const wrapper = document.getElementById('image-wrapper'); |
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 characters
| class CloseBtn extends HTMLElement { | |
| constructor() { | |
| super(); | |
| // Event listener | |
| const clickHandler = function(event) { | |
| console.log('event target', event.target) | |
| } | |
| // Create a shadow root |
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 characters
| <div> | |
| <!-- begin close button --> | |
| <close-btn></close-btn> | |
| <!-- end close button --> | |
| <p>Blah blah I say some stuff</p> | |
| </div> | |
| <div> | |
| <!-- begin close button --> | |
| <close-btn></close-btn> |
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 characters
| <div> | |
| <!-- begin close button --> | |
| <div class="btn-wrapper> | |
| <button> | |
| <svg width="34" height="34" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| <path d="M1 1L7 7M13 13L7 7M7 7L13 1L1 13" stroke="red" stroke-width="2"/> | |
| </svg> | |
| </button> | |
| </div> | |
| <!-- end close button --> |
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 characters
| <template></template> | |
| <script lang="ts"> | |
| import Vue from 'vue'; | |
| import Component from 'vue-class-component'; | |
| import ListItem from '@/components/ListItem.vue'; | |
| import { ListItemModel, listData } from '../data/groceryListData'; | |
| @Component({ | |
| components: { ListItem }, |
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 characters
| <template></template> | |
| <script lang="ts"> | |
| import Vue from 'vue'; | |
| import ListItem from '@/components/ListItem.vue'; | |
| import { ListItemModel, listData } from '../data/groceryListData'; | |
| export default Vue.extend({ | |
| name: 'GroceryList', | |
| components: { ListItem }, |
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 characters
| <template></template> | |
| <script> | |
| import ListItem from '@/components/ListItem.vue'; | |
| import listData from '../data/groceryListData'; | |
| export default { | |
| name: 'GroceryList', | |
| components: { ListItem }, | |
| data() { |
NewerOlder