並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 35 件 / 35件

新着順 人気順

javascript settimeout call async functionの検索結果1 - 35 件 / 35件

  • 実装例から見る React のテストの書き方 - Cybozu Inside Out | サイボウズエンジニアのブログ

    2024/04/17: 更新 内容を更新した記事を書きましたので、よかったらこちらも併せて、ご覧ください。 zenn.dev こんにちは!フロントエンドエキスパートチームの@nus3_です。 kintone のフロントエンド刷新プロジェクト(フロリア)では、品質を保ったまま開発を加速させるためにフロントエンドのテストを積極的に行っています。 今回はそんなフロントエンドのテストの実装例をいくつか紹介します。この記事がフロントエンドのテストを行う上での参考になれば幸いです。 テストに使用する主なパッケージ コンポーネントのテスト 補足: Testing Library の記法をチェックしてくれるeslint-plugin-testing-library カスタムフックのテスト 補足: React v18 では @testing-library/react の renderHook を使う 参考

      実装例から見る React のテストの書き方 - Cybozu Inside Out | サイボウズエンジニアのブログ
    • JavaScriptのforEachでawaitが効かない理由 - Qiita

      背景 JavaScriptでは forEach という配列から要素を取り出して反復処理できる関数があります。 前の記事 JavaScriptのforEach内でbreakができない理由【備忘録】 では、 forEach の中では break が使えず、途中でループを抜けることができない理由についてまとめました。 今回はその続きとして、forEach の内部で await を使った場合に、非同期処理の完了を待たずに次の処理へ進んでしまう、という挙動について理由を調べてみました。 forEach内でawaitしてみる forEach の中で await して得られた値を配列に追加し、 forEach の直後に配列を console.log で出力する例で確認します。 for文の感覚でいえば、イテレーション中の await で都度処理を待ってくれるイメージなので、全ての要素への処理が終わったら配

      • Patterns for Reactivity with Modern Vanilla JavaScript – Frontend Masters Blog

        “Reactivity” is how systems react to changes in data. There are many types of reactivity, but for this article, reactivity is when data changes, you do things. Reactivity Patterns are Core to Web Development We handle a lot with JavaScript in websites and web apps since the browser is an entirely asynchronous environment. We must respond to user inputs, communicate with servers, log, perform, etc.

          Patterns for Reactivity with Modern Vanilla JavaScript – Frontend Masters Blog
        • Announcing TypeScript 5.2 - TypeScript

          Today we’re excited to announce the release of TypeScript 5.2! If you’re not familiar with TypeScript, it’s a language that builds on top of JavaScript by making it possible to declare and describe types. Writing types in our code allows us to explain intent and have other tools check our code to catch mistakes like typos, issues with null and undefined, and more. Types also power TypeScript’s edi

            Announcing TypeScript 5.2 - TypeScript
          • Bringing Javascript to WebAssembly for Shopify Functions - Shopify

            Bringing Javascript to WebAssembly for Shopify FunctionsWhile we’re working on getting our Shopify Functions infrastructure ready for the public beta, we thought we’d use this opportunity to shine some light on how we brought JavaScript to WebAssembly, how we made everything fit within our very tight Shopify Function constraints, and what our plans for the future look like. At Winter Editions 2023

              Bringing Javascript to WebAssembly for Shopify Functions - Shopify
            • Deno 1.12 へのアップデートと変更事項まとめ - 虎の穴ラボ技術ブログ

              皆さんこんにちは、暑い中ですがお元気ですか?おっくんです。 去る 2021 年 7 月 13 日に Deno 1.12 がリリースされました。 今回も、リリースノートを参考に 変更事項の気になるところを紹介したいと思います。 実行環境 macOS Catalina 10.15.7 Docker イメージ denoland/deno:centos(確認時点では Deno 1.12.0 でした) Deno 1.12 Deno 1.12 での変更事項をDeno 1.12 リリースノートを元に確認します。 deno.com Web Crypto API の対応メソッドが増えました Deno 1.12 では、 以下のWeb Crypto APIの 3 つの実装が追加されました。 crypto.subtle.generateKey キー生成 crypto.subtle.sign 署名 crypto.s

                Deno 1.12 へのアップデートと変更事項まとめ - 虎の穴ラボ技術ブログ
              • Node.js compatibility for Cloudflare Workers – starting with Async Context Tracking, EventEmitter, Buffer, assert, and util

                Node.js compatibility for Cloudflare Workers – starting with Async Context Tracking, EventEmitter, Buffer, assert, and util2023-03-23 Over the coming months, Cloudflare Workers will start to roll out built-in compatibility with Node.js core APIs as part of an effort to support increased compatibility across JavaScript runtimes. We are happy to announce today that the first of these Node.js APIs –

                  Node.js compatibility for Cloudflare Workers – starting with Async Context Tracking, EventEmitter, Buffer, assert, and util
                • Announcing TypeScript 5.2 RC - TypeScript

                  Today we’re excited to announce our Release Candidate of TypeScript 5.2! Between now and the stable release of TypeScript 5.2, we expect no further changes apart from critical bug fixes. To get started using the RC, you can get it through NuGet, or through npm with the following command: npm install -D typescript@rc Here’s a quick list of what’s new in TypeScript 5.2! using Declarations and Explic

                    Announcing TypeScript 5.2 RC - TypeScript
                  • Announcing TypeScript 5.4 - TypeScript

                    Today we’re excited to announce the release of TypeScript 5.4! If you’re not familiar with TypeScript, it’s a language that builds on top of JavaScript by making it possible to declare and describe types. Writing types in our code allows us to explain intent and have other tools check our code to catch mistakes like typos, issues with null and undefined, and more. Types also power TypeScript’s edi

                      Announcing TypeScript 5.4 - TypeScript
                    • Wasm core dumps and debugging Rust in Cloudflare Workers

                      Wasm core dumps and debugging Rust in Cloudflare Workers2023-08-14 A clear sign of maturing for any new programming language or environment is how easy and efficient debugging them is. Programming, like any other complex task, involves various challenges and potential pitfalls. Logic errors, off-by-ones, null pointer dereferences, and memory leaks are some examples of things that can make software

                        Wasm core dumps and debugging Rust in Cloudflare Workers
                      • Comprehensive guide to JavaScript performance analysis using Chrome DevTools

                        Comprehensive guide to JavaScript performance analysis using Chrome DevTools Let's see how to navigate the Chrome Devtools Performance tab to effectively analyse and improve the performance of your JavaScript while avoiding common errors. Our use case will be improving the rendering FPS of a real-world canvas library. A few weeks ago a colleague of mine and I were looking at the canvas engine comp

                          Comprehensive guide to JavaScript performance analysis using Chrome DevTools
                        • Announcing TypeScript 5.4 Beta - TypeScript

                          Today we are excited to announce the availability of TypeScript 5.4 Beta. To get started using the beta, you can get it through NuGet, or through npm with the following command: npm install -D typescript@beta Here’s a quick list of what’s new in TypeScript 5.4! Preserved Narrowing in Closures Following Last Assignments The NoInfer Utility Type Object.groupBy and Map.groupBy Support for require() c

                            Announcing TypeScript 5.4 Beta - TypeScript
                          • Scheme in the browser: A Hoot of a tale -- Spritely Institute

                            Scheme in the browser: A Hoot of a taleDave Thompson — October 10, 2023 Hey there, it’s been a while! We’re back to share some more exciting news about Guile Hoot, a WebAssembly toolchain and Scheme→WASM compiler. In our last post we demonstrated that the Guile Hoot toolchain can be used to assemble programs written in WebAssembly Text (WAT) format, which allowed us to develop for the WASM-4 fanta

                              Scheme in the browser: A Hoot of a tale -- Spritely Institute
                            • graphql/dataloader を読んだ話

                              graphql/dataloader のドキュメント及びソースコードを全て読んだので、その話を書く。 読むことにした第一の理由は仕事で使うからだが、以下の特徴から自分のプログラミング学習教材として適していそうだと考えたからでもある。 広く使われている OSS である GitHub の星が 11k npm trends で検索しても多くの人がダウンロードしている コードの量が少ない 実装は src/index.js に全て書かれている コメント含めて 500 行にも満たず、しかもその 1/3 くらいはコメント テストカバレッジが高い 常に 100% 初めて読むコードでテストカバレッジが高いと、テストコードを読むことで期待される挙動を確認できるので嬉しい npm trends によると、一週間で 200 万件近くダウンロードされているようだ。 目次 graphql/dataloader とは

                                graphql/dataloader を読んだ話
                              • AbortController is your friend

                                AbortController is your friend One of my favorite new features of JS is the humble AbortController, and its AbortSignal. It enables some new development patterns, which I'll cover below, but first: the canonical demo. It's to use AbortController to provide a fetch() you can abort early: Sorry, your browser doesn't support an inline demo. And here's a simplified version of the demo's code: fetchBut

                                  AbortController is your friend
                                • New Architecture is here · React Native

                                  React Native 0.76 with the New Architecture by default is now available on npm! In the 0.76 release blog post, we shared a list of significant changes included in this version. In this post, we provide an overview of the New Architecture and how it shapes the future of React Native. The New Architecture adds full support for modern React features, including Suspense, Transitions, automatic batchin

                                    New Architecture is here · React Native
                                  • ChatGPT Translate翻訳環境構築 - 井出草平の研究ノート

                                    ChatGPT TranslateをWindows環境においてDeepLのアプリのように使うための設定書である。グローバルホットキー(Ctrl+Alt+T)で翻訳できるように設定してある。DeepLに対する優位性と課題はある。 本マニュアルで構築する「ChatGPT Translate」の自動翻訳環境は、定番の翻訳ツールであるDeepLと比較して明確な一長一短がある。 【利点】DeepLより優れている点 圧倒的な翻訳精度と文脈理解(最大の利点): 単なる直訳ではなく、前後の文脈、細かなニュアンス、高度な専門用語を深く汲み取り、人間が書いたような極めて自然な文章に翻訳できる。 ノイズや乱れに対する強力な補正力: コピー時に混ざった不自然な改行や、OCR(画像文字認識)の誤字脱字、砕けたスラングなどでも、AIが文脈から自動推測して綺麗に補正しながら翻訳してくれる。 【欠点】DeepLに劣ってい

                                      ChatGPT Translate翻訳環境構築 - 井出草平の研究ノート
                                    • Announcing TypeScript 5.4 RC - TypeScript

                                      Today we’re excited to announce our Release Candidate of TypeScript 5.4! Between now and the stable release of TypeScript 5.4, we expect no further changes apart from critical bug fixes. To get started using the RC, you can get it through NuGet, or through npm with the following command: npm install -D typescript@rc Here’s a quick list of what’s new in TypeScript 5.4! Preserved Narrowing in Closur

                                        Announcing TypeScript 5.4 RC - TypeScript
                                      • Explicit Resource Management: Exploring JavaScript's and TypeScript's new feature | iliazeus

                                        One of my favorite new features of JavaScript and TypeScript is explicit resource management. It brings new syntax, using foobar = ..., that enables RAII, reducing boilerplate when managing the lifecycle of various resources. In this article, I will explore this feature as implemented in TypeScript 5.2.0 with the disposablestack polyfill. I will mention both sync and async resources, DisposableSta

                                        • async/await周りで苦しんだ箇所の例と対策 | DevelopersIO

                                          どうも。CX事業本部Delivery部のえーたん(@eetann092)です。 今まで雰囲気でJavaScript(TypeScript)のasync/await、Promiseを使っていて最近苦しんだため、ハマったところの例と対策を備忘録として残しておきます。 await付け忘れ やらかした例 まず、awaitを付け忘れた例です。 import { setTimeout } from "timers/promises"; const unit = 1000; async function logSleepLog(msg: string) { console.log(msg); await setTimeout(1.5 * unit); console.log(msg); } (async () => { logSleepLog("hoo"); console.log("finish");

                                            async/await周りで苦しんだ箇所の例と対策 | DevelopersIO
                                          • Announcing TypeScript 5.2 Beta - TypeScript

                                            Today we are excited to announce the availability of TypeScript 5.2 Beta. To get started using the beta, you can get it through NuGet, or through npm with the following command: npm install -D typescript@beta Here’s a quick list of what’s new in TypeScript 5.2! using Declarations and Explicit Resource Management Decorator Metadata Named and Anonymous Tuple Elements Easier Method Usage for Unions o

                                              Announcing TypeScript 5.2 Beta - TypeScript
                                            • What does the image decoding attribute actually do?

                                              Err... thanks for the technical explanation. But what does this actually mean in real life? Which setting should you use? Does it even matter? And if it does, why don't those clever browser engineers just set it to the best setting? Well recently I ranted on Twitter about this (as I am often want to do!) in a long thread that really should have been a blog post. So here is that blog post. Some mis

                                                What does the image decoding attribute actually do?
                                              • jott - js_gc_in_wasm

                                                # JavaScript Garbage Collection with WebAssembly is Possible Today *by [@bwasti](https://twitter.com/bwasti)* **** tl;dr - Using [WeakRefs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef), you can pretty easily implement automatic memory management for objects exposed from WebAssembly with JavaScript's garbage collector. *(Keep in mind "automatic memory ma

                                                • Introducing TanStack Start Middleware – Frontend Masters Blog

                                                  TanStack Start is one of the most exciting full-stack web development frameworks I’ve seen. I’ve written about it before. In essence, TanStack Start takes TanStack Router, a superb, strongly-typed client-side JavaScript framework, and adds server-side support. This serves two purposes: it gives you a place to execute server-side code, like database access; and it enables server-side rendering, or

                                                    Introducing TanStack Start Middleware – Frontend Masters Blog
                                                  • An overview of Node.js: architecture, APIs, event loop, concurrency

                                                    Warning: This blog post is outdated. Instead, read chapter “An overview of Node.js: architecture, APIs, event loop, concurrency” in “Shell scripting with Node.js”. This blog post gives an overview of how Node.js works: What its architecture looks like. How its APIs are structured. A few highlights of its global variables and built-in modules. How it runs JavaScript in a single thread via an event

                                                    • オンライン決済Stripe(ストライプ)を導入するための組み込み方法の基礎 | アールエフェクト

                                                      Stripeを導入するためにStripeのドキュメントを確認したけれどどこから何を始めていいのかわからなかったという人を対象にStripeを導入するために必要な組み込み方法を説明しています。Stripeでオンライン決済といってもプログラミングの得意な人向けの方法から全くプラグラミングがわからない人でもお手軽に導入できる方法まで幅広い方法が提供されています。その上、プログラミングを使って組み込む方法も一つではなくシチュエーションによって利用するAPIが異なるため混乱する人も多いと思いますのでぜひ参考にしてみてください。Stripeの料金体系や成り立ちなどの説明はなく組み込み方法を中心にStripeの基本的な仕組みを理解したい技術者向けの内容になっています。 アカウントの作成 Stripeを利用するためにはStripeのアカウントを作成する必要があります。テスト目的で利用する場合は名前、メール

                                                        オンライン決済Stripe(ストライプ)を導入するための組み込み方法の基礎 | アールエフェクト
                                                      • JavaScript Interview Questions

                                                        Here is a list of common JavaScript interview questions with detailed answers to help you prepare for the interview as a JavaScript developer. JavaScript continues to be a cornerstone of web development, powering dynamic and interactive experiences across the web. As the language evolves, so does the complexity and scope of interview questions for JavaScript developers. Whether you’re a fresher de

                                                          JavaScript Interview Questions
                                                        • Python behind the scenes #12: how async/await works in Python

                                                          Mark functions as async. Call them with await. All of a sudden, your program becomes asynchronous – it can do useful things while it waits for other things, such as I/O operations, to complete. Code written in the async/await style looks like regular synchronous code but works very differently. To understand how it works, one should be familiar with many non-trivial concepts including concurrency,

                                                          • Scheduling Internals

                                                            A sneak peek to what's coming! I remember when I first learned that you can write a server handling millions of clients running on just a single thread, my mind was simply blown away 🤯 I used Node.js while knowing it is single threaded, I used async / await in Python, and I used threads, but never asked myself "How is any of this possible?". This post is written to spread the genius of concurrenc

                                                              Scheduling Internals
                                                            • ​Asynchronous programming with JavaScript

                                                              JavaScript is a single-threaded language (single call stack). So, how can it be asynchronous? Are you also having the same thoughts? This article will explain how we can do asynchronous programming in JavaScript. However, before getting into that, let us first understand what asynchronous programming is and the difference between synchronous and asynchronous coding. What is Asynchronous Programmin

                                                                ​Asynchronous programming with JavaScript
                                                              • Some mistakes Rust doesn't catch

                                                                Thanks to my sponsors: Mike English, Anson VanDoren, Malik Bougacha, Antoine Rouaze, Brooke Tilley, Em Sharnoff, kuerbsikakteen, Nicolas Riebesel, Matt Jadczak, Bob Ippolito, Corey Alexander, Simon Menke, Carson Page, Jelle Besseling, Taneli Kaivola, you got maiL, Sean Bryant, Manuel Hutter, Ben Mitchell, Matt Heise and 253 more I still get excited about programming languages. But these days, it’s

                                                                  Some mistakes Rust doesn't catch
                                                                • March 2024 (version 1.88)

                                                                  Update 1.88.1: The update addresses these issues. Downloads: Windows: x64 Arm64 | Mac: Universal Intel silicon | Linux: deb rpm tarball Arm snap Welcome to the March 2024 release of Visual Studio Code. There are many updates in this version that we hope you'll like, some of the key highlights include: Apply custom editor labels - Distinguish between editors with same file names. Locked scrolling -

                                                                    March 2024 (version 1.88)
                                                                  • Understanding React Server Components | Tony Alicea

                                                                    React Server Components have lifted server-rendering to be a truly first-class citizen of the React ecosystem. They allow developers to render some components on the server, while attempting to abstract away the divide between the client and server. Devs can interleave Client and Server Components in their code as if all the code was running in one place. Yet, abstractions always come at a cost. W

                                                                      Understanding React Server Components | Tony Alicea
                                                                    • Account hijacking using "dirty dancing" in sign-in OAuth-flows

                                                                      Account hijacking using “dirty dancing” in sign-in OAuth-flows Combining response-type switching, invalid state and redirect-uri quirks using OAuth, with third-party javascript-inclusions has multiple vulnerable scenarios where authorization codes or tokens could leak to an attacker. This could be used in attacks for single-click account takeovers. Frans Rosén, Security Advisor at Detectify goes t

                                                                        Account hijacking using "dirty dancing" in sign-in OAuth-flows
                                                                      • 2022/5 async/awaitから理解するJavaScript非同期処理 - 株式会社クリエーション・ビュー

                                                                        TECHNICAL BLOG 2022/5/30 # JavaScript # Node.js 2022/5 async/awaitから理解するJavaScript非同期処理 最近身の回りにJavaScriptを使う人が増えています。フロントエンドエンジニア(自称)としては嬉しい限りです。そんな中、非同期処理について聞かれることが多いので、初学者にもなるべくわかりやすく説明してみたいと思います。 インターネットでJavaScriptの非同期処理について検索すると、コールバック、Promise、async/await...というように、難しい話がたくさん出てきて混乱すると思います。 非同期処理についてはコールバック関数、Promise、async/awaitの順番で学んでいくのが普通ですが、コールバック関数、Promiseは少し難しいので、以下の順番で説明していこうと思います。 async/

                                                                          2022/5 async/awaitから理解するJavaScript非同期処理 - 株式会社クリエーション・ビュー
                                                                        1