LoginSignup
0
1

More than 5 years have passed since last update.

Javascript note

Last updated at Posted at 2018-03-15

Angular, React, Vue 比較

ES6で書いてJSに変換してくれるすげぇ簡単なタスクランナーの設定

1、以下をnpm install

  • babel-core
  • babel-preset-env
  • babel-preset-react
  • babelify
  • browserify

2、以下をnodeで叩く

/*
INFO:
- process.argv[2]: 第一引数が代入されている `node node/compile.js {ここ}`
*/
compile(process.argv[2]);

function compile(SITE_ID) {
  var fs = require("fs");
  var browserify = require("browserify");
  browserify("./src/" + SITE_ID + ".js")
    .transform("babelify", {presets: ["env", "react"]})
    .bundle()
    .pipe(fs.createWriteStream("./build/" + SITE_ID + ".js"));
}

その要素にbindされているイベントと、その定義場所を知る

var ev = $._data(element, 'events');

変数の監視について

BookmarkLet

DOMを拡張する方法

ES6で使えるメソッドまとめ:

ヒアドキュメント関係:

.styleより.setAttribute

.styleは挙動がおかしいときがある

// thumbEl.style.backgroundImage = 'url(' + imgPath + ')';
thumbEl.setAttribute('style', 'background-image: url(' + imgPath + ')');

class関係:

document.weite script問題

image.png

scriptのasyncについて

  • asyncをつけないと、jsファイルの実行が完了するまで、HTML のパースは再開されません。続き...

評価されるタイミング #基本


// evaluate $xxx immediately:
ready($xxx);

// doesn't evaluate $xxx immediately:
ready(function(){
  $xxx();
});

use properly.
使い分けると良い。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1