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
// -------------------------------------------------------- | |
// "No javascript qualquer variável pode ser uma função ou o resultado de uma função" | |
function umaFuncao () { | |
console.log('faz coisas aqui dentro') | |
return 'e sempre deveria retornar alguma coisa' | |
} | |
const funcao = umaFuncao |
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
function renderState (state) { | |
var html = '<p>' + state.something + '</p>' | |
document.getElementById('root').innerHTML = html | |
} | |
function createStore() { | |
var state = { | |
something: "olá mundo" | |
} | |
renderState(state) |
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
function renderState (state) { | |
var html = '<p>' + state.something + '</p>' | |
document.getElementById('root').innerHTML = html | |
} | |
function createStore() { | |
var state = { | |
something: "olá mundo" | |
} | |
renderState(state) |
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
function renderState (state) { | |
var html = '<p>' + state.something + '</p>' | |
document.getElementById('root').innerHTML = html | |
} |
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
function createStore() { | |
var state = {} | |
return { | |
getState: function () { | |
return state | |
}, | |
setState: function (newState) { | |
state = newState | |
} |
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
<html> | |
<head> | |
<meta charset="utf-8"/> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script src="main.js"></script> | |
</body> | |
</html> |
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
function createStore (reducers) { | |
var state = reducers() | |
const store = { | |
dispatch: (action) => { | |
state = reducers(state, action) | |
}, | |
getState: () => { | |
return state | |
} | |
} |
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 Immutable = require('immutable') | |
const add = (channels, name) => { | |
return channels.set(name, Immutable.List()) | |
} | |
const addAction = (channels, name, action) => { | |
return channels.set(name, channels.get(name).push(action)) | |
} |
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
// | |
// Motivations: | |
// | |
// * bring accessible functional programming to game development | |
// * handy and easy default options for quick game prototyping | |
// * flexibility for advanced game developers | |
const W = { | |
getAngle: (pointA, pointB) => null, | |
emit: (channel, message, data) => null |
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
// example of what this code would produce => http://worms.io/pocDeclarative | |
const makePlayer = () => { | |
return { | |
initial: { | |
size: [50, 50], | |
position: [10, 10], | |
physics: true | |
}, |