Skip to content

Instantly share code, notes, and snippets.

@shukn
shukn / App.vue
Last active May 28, 2019 17:01
Vuex調査
<template>
<div>
{{ storeCount }}
{{ localCount }}
{{ totalCount }}
<input type="button" @click="storeCountIncrement" value="increment">
</div>
</template>
<script>
@shukn
shukn / default_exports.js
Created May 19, 2019 08:27
export/import調査
// 波括弧をつけないとデフォルトエクスポートがインポートされる
import Hoge from "./sample_2.js";
console.log( Hoge ); //default exports
// defaultキーワードの別名としてインポート
import { default as Fuga }from "./sample_2.js";
console.log( Fuga ); //default exports
// 名前付きと同時にimport
import {
@shukn
shukn / async function.js
Last active May 12, 2019 13:13
async/wait調査
var asyncFunc = async function () {
return 1;
}
asyncFunc().then( v => console.log(v));
// 1
@shukn
shukn / Promise.js
Last active May 11, 2019 19:01
Promise調査
var promise = new Promise(function(resolve, reject) {
setTimeout(function() {
resolve(0);
}, 300);
});
promise
.then( value =>{
console.log(value);
// コールバック関数内でreturnすることで、値を後続の処理に引き渡せる。