This document discusses using various technologies for an Internet of Things project including Socket.io for real-time communication, BabylonJS for 3D rendering, and Node.js with Express.js for the backend server. It also mentions using Arduino and the Johnny-five library to control LEDs and interfaces between the physical devices and web application. Formats like glTF are discussed for 3D asset loading and exporting between tools like Cinema4D, Unity, and three.js.
Lerna is a tool that helps manage JavaScript projects with multiple packages in a monorepo. It is useful for projects like Babel, React, and Angular that have many related packages developed within a single repository. Lerna allows installing dependencies and publishing updates across all the packages at once rather than separately per package. It offers different modes for dependency management across packages like fixed or independent modes.
The document discusses virtual reality and augmented reality technologies including HTC Vive, Kinect, and Vive Tracker. It provides links to videos demonstrating their use for VR/AR applications and games at conferences like DojoCon2017. The technologies allow adding interactivity and virtual elements to physical spaces.
Reflux is a library for implementing unidirectional data flow architectures for React applications. It allows for creating actions that trigger stores to update, and hooking stores to React components so their state propagates as props. Examples demonstrate creating actions and stores, and connecting a store to a component to display its state. Reflux supports both manual and automatic listening to stores from components.
This document discusses Homebridge, an open source Node.js server that allows third party accessories like smart home devices to integrate with Apple's HomeKit. It provides instructions on installing Homebridge and examples of plugins that enable support for devices like IR kits and garage door openers. Key information discussed includes using Homebridge to emulate the HomeKit API, installing and configuring required Node modules, and examples of plugins that enable support for specific device types.
This code defines a getSearchResult function that returns a Promise to search for a document by ID. It executes a labellio_classify command on the model and search directories, passing the ID as a parameter. The callback function resolves the Promise with any returned data.
4. Koa
Koa is a new web framework designed by the team
behind Express, which aims to be a smaller, more
expressive, and more robust foundation for web
applications and APIs.
Through leveraging generators Koa allows you to ditch
callbacks and greatly increase error-handling.
Koa does not bundle any middleware within core, and
provides an elegant suite of methods that make writing
servers fast and enjoyable.
Via. http://koajs.com/
11. Koa要件
To use Koa you must be running node 0.11.9 or higher
for generator support
$ alias node='node --harmony'
package.json
"scripts": {
"start": "node --harmony app.js"
}
12. Koa sample
var koa = require('koa'),
app = koa();
app.use(function *() {
// Here is the important bit of application logic for this example.
// We make use of a series of async operations without callbacks.
var city = yield geolocation.getCityAsync(this.req.ip);・・・①
var forecast = yield weather.getForecastAsync(city);・・・②
this.body = 'Today, ' + city + ' will be ' + forecast.temperature
+ ' degrees.';・・・③
});
app.listen(8080);
Via. http://blog.stevensanderson.com/2013/12/21/
experiments-with-koa-and-javascript-generators/
16. Koa sample
app.use(function *() {
var tasks = {
imposeMinimumResponseTime: delay(500),
fetchWebPage: doHttpRequest('http://example.com/'),
squareTenSlowly: getSquareValueThunk(10)
};
// All of the operations have already started. Yielding
// the key-value object to Koa just makes it wait for them.
var results = yield tasks;
this.body = 'OK, all done.';
this.body += 'nResult of waiting is: ' + results.imposeMinimumResponseTime; // ①
Displays: undefined
this.body += 'nWeb page status code is: ' + results.fetchWebPage.statusCode; //
② Displays: Typically 200 in this case
this.body += 'nSquare of ten is: ' + results.squareTenSlowly; // ③ Displays: 100
});
Via. http://blog.stevensanderson.com/2013/12/21/
experiments-with-koa-and-javascript-generators/
26. Koa log middleware
// x-response-time
!
app.use(function *(next){
var start = new Date;
yield next;
var ms = new Date - start;
this.set('X-Response-Time', ms + 'ms');
});
Via. http://dailyjs.com/2014/01/09/koa/
27. middleware
request
yield next;
yield next;
yield next;
middleware
middleware
middleware
try catch(e)
error
error
var start = new Date;
var ms = new Date - start;
response
response
response
response
middleware
error