https://asciidwango.github.io/js-primer/basic/async/#promsie-exception
以下の2つは全く同じコード
Promise.resolve()
.then(function() {
console.log(1);
import { chop1, chop2, chop3, chop4, chop5 } from "app/features/code-kata/kata02/index"; | |
describe("kata02", () => { | |
function assert_equal(result: number, expected: number) { | |
expect(expected).toBe(result); | |
} | |
function its(logic: (a: number, b: number[]) => number) { | |
it("1", () => assert_equal(-1, logic(3, []))); | |
it("2", () => assert_equal(-1, logic(3, [1]))); | |
it("3", () => assert_equal(0, logic(1, [1]))); |
import { Meta, Story } from "@storybook/react"; | |
import { Page } from "."; | |
import { Route } from "react-router"; | |
import { RouterDecorator } from "../../router/RouterDecorator"; | |
import { useUrl } from "../../router/useUrl"; | |
const meta: Meta = { | |
title: "Samples/SpecificRoute", | |
component: Page, | |
decorators: [RouterDecorator()] | |
}; |
import { Meta, Story } from "@storybook/react"; | |
import React from "react"; | |
import { Page } from "."; | |
import { text } from "../../emulations/text"; | |
const meta: Meta = { | |
title: "Samples/InputEmulations", | |
component: Page, | |
decorators: [] | |
}; |
import { Meta, Story } from "@storybook/react"; | |
import { Page } from "."; | |
import { getUserHandler } from "../../msw-handlers/user-handler"; | |
const getHandlers = (options: Partial<{ loading: boolean }> = {}) => { | |
const { loading = false } = options; | |
return [ | |
getUserHandler({ | |
id: "user-1", | |
loading |
import { Meta, Story } from "@storybook/react"; | |
import { useState } from "../../redux-decorator/redux-debug"; | |
import { ReduxDecorator } from "../../redux-decorator/ReduxDecorator"; | |
import { Page } from "."; | |
const meta: Meta = { | |
title: "Samples/ReduxDecorator", | |
component: Page, | |
decorators: [ReduxDecorator()] | |
}; |
import { privateNoopReducer, ReducerRegistry } from "../ReducerRegistry"; | |
describe("app/store/ReducerRegistry", () => { | |
describe("prepare (設定済みのregistoryに準備を要求する)", () => { | |
it("要求したloaderが呼び出されてmapで設定した位置にreducerが設定される", async () => { | |
const mockReducer = jest.fn(); | |
const map = { | |
p1: async () => { | |
return Promise.resolve(mockReducer); | |
}, |
https://asciidwango.github.io/js-primer/basic/async/#promsie-exception
以下の2つは全く同じコード
Promise.resolve()
.then(function() {
console.log(1);
dist | |
dist/index.html | |
dist/static | |
dist/static/js | |
dist/static/js/app.c0a071d6.js | |
dist/static/js/runtime~app.80093f6b938c45dfa1fa.js | |
dist/static/js/vendors.389df6a6.js | |
dist/assets.json |
const loaderUtils = require("loader-utils"); | |
module.exports = function(source, map, meta ) { | |
const options = loaderUtils.getOptions(this) || {prefix: '', returnInPitch: false}; | |
const {prefix, returnInPitch } = options; | |
print(options); | |
print(options); | |
print(options); | |
print(options); | |
print(options, `--------------------- ${prefix} normal --------------------------`); |