prototype
・基底クラスが持つ
Array.prototype
Function.prototype
//http://kenjimorita.jp/typescript__extends_new__ | |
//ここの説明 | |
var __extends = (this && this.__extends) || function (d, b) {//d = Point3D, b = _super(Point) | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];//1 | |
function __() { this.constructor = d; } | |
d.prototype = b === null | |
? Object.create(b)// nullなら{}を返す |
function Animal() { } | |
Animal.prototype.walk = function () { console.log('walk') }; | |
function Bird() { } | |
Bird.prototype.__proto__ = Animal.prototype;//ここの部分 | |
Bird.prototype.fly = function () { console.log('fly') }; | |
var bird = new Bird(); | |
bird.walk(); | |
bird.fly(); |
//1 | |
function __() { this.constructor = d; } | |
//2 | |
__.prototype = b.prototype; | |
//3 | |
d.prototype = new __(); | |
//Example code | |
//これがnormalとlooseでどこが変わるのか・・ | |
/////////////////////////// | |
class Point { | |
constructor(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
toString() { | |
return `(${this.x}, ${this.y})`; |
function setup(){ | |
createCanvas(windowWidth, windowHeight); | |
rectMode(CENTER); | |
} | |
function draw (){ | |
background(150); | |
strokeWeight(2); | |
stroke(255); | |
fill(0, 0); | |
rect(windowWidth/2, windowHeight/2, windowWidth/4, windowHeight/8); //@param startX, startY, rectWidth, rectHight |
→HTML、CSS、JSファイルを取り込み画面上にピクセルをレンダリングさせること
→各ファイルのバイトの受信からこれらをピクセルとしてレンダリングするために必要な処理までの中間段階(クリティカルレンダリングパス)を最適化すること
//html | |
//<div id="ran">0</div> | |
//<button id="button">click</button> | |
// | |
if(window.history || window.history.pushState){ | |
var button = document.getElementById("button"); | |
var ran = document.getElementById("ran"); | |
button.onclick = function(){ | |
var random = Math.floor(Math.random() * 11); |
demo visit on iOS safari private mode
//やること1 | |
npm i -D react-router-dom@4.0.0 | |
//react-routerで使っていたモジュールはreact-router-domから呼びます | |
//やること2 | |
//v3.x | |
import {browserHistory, IndexRoute, Redirect, Router, Route, NotFoundRoute, DefaultRoute, Link, RouteHandler} from 'react-router'; |