<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>madogiwa0124</author_name>
  <author_url>https://blog.hatena.ne.jp/madogiwa0124/</author_url>
  <blog_title>Madogiwa Blog</blog_title>
  <blog_url>https://madogiwa0124.hatenablog.com/</blog_url>
  <categories>
    <anon>JavaScript</anon>
    <anon>開発</anon>
  </categories>
  <description>JavaScriptを使った非同期処理を実装するときに、 try-catchで囲うとか、isLoadingやsuccessといったstateを用意して、 状態を管理すようなロジックが個人的にそれぞれのメソッドに書きがちになっていて、 毎回実装するのが手間、また実行漏れがあったりと共通化したいなぁと思っていたのですが、 JavaScriptのクロージャーを使うをいい感じに共通化出来た気がしたのでメモしておきます📝 クロージャーとは？ 普通に実装したサンプル クロージャーを使って共通化してみる おわりに 参考 クロージャーとは？ MDNのドキュメントを見てみるとクロージャーとは下記とのことです。 …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmadogiwa0124.hatenablog.com%2Fentry%2F2020%2F09%2F20%2F232532&quot; title=&quot;JavaScript: クロージャーを使ってレキシカル環境ごと関数を渡して処理を共通化するメモ📝 - Madogiwa Blog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-09-20 23:25:32</published>
  <title>JavaScript: クロージャーを使ってレキシカル環境ごと関数を渡して処理を共通化するメモ📝</title>
  <type>rich</type>
  <url>https://madogiwa0124.hatenablog.com/entry/2020/09/20/232532</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
