Sometimes you'll have objects that manage state along with event handling. This happens frequently in MVC apps. Let's start with a messy example:
var Launcher = function(rocket) {
this.rocket = rocket
}
Launcher.prototype.isReady = function() {
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| // AtScript | |
| import {Component} from 'angular'; | |
| import {Server} from './server'; | |
| @Component({selector: 'foo'}) | |
| export class MyComponent { | |
| constructor(server:Server) { | |
| this.server = server; | |
| } | |
| } |
| http://www.html5rocks.com/en/tutorials/es7/observe/ | |
| http://ng-learn.org/2014/03/AngularJS-2-Status-Preview/ | |
| http://eisenbergeffect.bluespire.com/all-about-angular-2-0/ | |
| http://www.w3.org/wiki/WebComponents/ | |
| https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit97HnZoKVygDxpWzEYW0U/edit | |
| https://speakerdeck.com/rauschma/ecmascript-6-whats-next-for-javascript-august-2014 | |
| http://pascalprecht.github.io/2014/10/25/integrating-web-components-with-angularjs/ | |
| https://docs.google.com/document/d/1kpuR512G1b0D8egl9245OHaG0cFh0ST0ekhD_g8sxtI/edit#heading=h.xgjl2srtytjt | |
| https://docs.google.com/presentation/d/1Gv-dvU-yy6WY7SiNJ9QRo9XayPS6N2jtgWezdRpoI04/present?slide=id.g108668b30_040 | |
| http://code.tutsplus.com/tutorials/using-polymer-to-create-web-components--cms-20475 |
| From the chat: | |
| Vijay Velagapudi 12:16 PM | |
| no problem | |
| To list all available commands enter "/?". | |
| John Elliott 12:23 PM | |
| https://dl.dropboxusercontent.com/u/23241016/startup%20engineering%20public/Lecture-all.pdf - Lecture Notes in one file on Dropbox | |
| Nghia Hoang 12:23 PM |
| <?xml version="1.0" encoding="utf-8"?> | |
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| package="app.to.webpage.webpagetoapp" | |
| android:versionCode="1" | |
| android:versionName="1.0" > | |
| <uses-sdk | |
| android:minSdkVersion="10" | |
| android:targetSdkVersion="18" /> | |
| <uses-permission android:name="android.permission.INTERNET"/> |
| // Draws a Mickey | |
| void setup() { | |
| // Sets sketch size | |
| size(600, 600); | |
| // Translates origin point (now "0, 0" are placed at "width / 2, height / 2" and not at upper left corner anymore) | |
| translate(width / 2, height / 2); | |
| // Sets background color | |
| background(200); | |
| // Disables all smoothing |
| // Gemini | |
| // http://stardate.org/nightsky/constellations/gemini | |
| void setup() { | |
| // Sets sketch size | |
| size(400, 400); | |
| // Translates origin point (now "0, 0" are placed at "width / 5, height / 5" and not at upper left corner anymore) | |
| translate(width / 5, height / 5); | |
| // Sets background color | |
| background(0); |
| fetchJSONFile("https://api.github.com/users/" + userName + "/subscriptions", function(data){ | |
| ... | |
| } | |
| function fetchJSONFile(path, callback) { | |
| var httpRequest = new XMLHttpRequest(); | |
| httpRequest.onreadystatechange = function() { | |
| if (httpRequest.readyState === 4) { | |
| if (httpRequest.status === 200) { | |
| var data = JSON.parse(httpRequest.responseText); |
| var Pusher = require('pusher'), | |
| os = require('os'), | |
| express = require('express'), | |
| app = express(), | |
| ch = 'stats'; | |
| var pusher = new Pusher({ | |
| appId: process.env.PUSHER_APP_ID, | |
| key: process.env.PUSHER_KEY, | |
| secret: process.env.PUSHER_SECRET |