This file contains 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
import React, { useState } from 'react'; | |
import './RoombaGrid.css'; | |
// 90 right | 180 down | 270 left | 0 up | |
enum Direction { | |
'up' = 0, | |
'right' = 90, | |
'down' = 180, | |
'left' = 270, |
This file contains 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
import React, { useState, useEffect } from 'react'; | |
import { getWinner } from './game-rules'; | |
import './Grid.css'; | |
enum Player { | |
playerOne = 'X', | |
playerTwo = 'O', | |
} |
This file contains 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
// there are examples I have where I would need to use load() as a callback after mutating the service collection | |
// I know there are 'hacks' to repaint the dom with ng1 | |
// point is we have to worry about or data being up to date in the view | |
load() { | |
this.service.load() // here you may recieve a promise or observable depending on which angular version you're in | |
-> this.collection = response; | |
} | |
save(item) { |
This file contains 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
/* I have a gloabal ctrl which sits within my tabs.html. This way I have access to the global view model (controller) whereveer I want. */ | |
TabsCtrl.$inject = ['$ionicViewSwitcher', '$ionicHistory']; | |
export default function TabsCtrl($ionicViewSwitcher, $ionicHistory) { | |
/* use our custom animation on click when this method is called */ | |
function actionView(isExit) { | |
if ($ionicHistory.backView() !== null) { | |
var backView = $ionicHistory.backView(); | |
/* sometimes we want native transitions even though we are returning from a slide in up animation. |
This file contains 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
#Let's build a native an app with web technology: The Challenge | |
###Why building Native is difficult | |
* compiling e...v...e...r...y... t...i...m...e! Thank you node. | |
* creating views is difficult. Manually compute size and layout of our views. | |
* we're web developers who enjoy the increased productivity that comes with our | |
modern development environment. | |
###Why Native is better | |
* platform-specific UI components, like maps, date pickers, switches, navigation |