<script>
let name = 'world';
</script>
<h1>Hello {name}!</h1>
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
<html> | |
<body> | |
<div> | |
<button onClick="onButton()">Hello</button> | |
</div> | |
<script> | |
// credit: https://dbaron.org/log/20100309-faster-timeouts | |
const eventQueue = []; |
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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
) |
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
const TodoTx = require('./src/app/todo-tx'); | |
// the transmission layer *is* the app | |
const app = new TodoTx(); | |
app.run(); |
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
const Emitter = require('../../lib/emitter'); | |
const vorpal = require('vorpal'); | |
const events = { | |
INIT:'init', | |
CREATE_TODO: 'CREATE_TODO', | |
GET_TODO_LIST: 'GET_TODO_LIST' | |
}; | |
const constants = { |
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
const Emitter = require('../../lib/emitter'); | |
const events = { | |
INIT:'init', | |
CREATE_TODO: 'createTodo' | |
}; | |
const constants = { | |
status: { | |
TODO: 'TODO', |
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 the engine and shell as two independent modules | |
const TodoEngine = require('../engine/todo-engine'); | |
const TodoShell = require('../shell/todo-shell'); | |
/** | |
* This is the app -- it connects the business logic of the | |
* TodoEngine to the presentation capabilities of the TodoShell | |
*/ | |
class TodoTx { | |
constructor() { |
- Until ECMA6, JavaScript had no classes. It had (and still has) prototypes.
- A class is like a mold from which you build an object. A prototype is itself an object.
// think of this as the class AND its constructor
var Person = function() {
this.canTalk = true;
};
// this is a 'class method'
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
// connectivity: ITERATION 1 | |
var database = new Database('companydb'); | |
database.connect(function(db) { | |
if (db.error) { | |
// handle error | |
} | |
// continue db ops | |
}); |
NewerOlder