Let’s reuse a JS library, which exposes a promise-based API, in our ReasonML (ReasonReact) code. We will write bindings for a JS library and for its object methods. As an example, we can take the Zoomdata JS SDK. It can connect to the backend database, construct data query, and then execute it and get some data from backend. All of these actions are completely asynchronous, so they all return Java
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015. Learn moreSee full compatibilityReport feedback Promise.race() は静的メソッドで、入力としてプロミスの反復可能オブジェクトを受け取り、単一の Promise を返します。この返されたプロミスは、最初に決定したプロミスの最終的な状態で決定されます。 const promise1 = new Promise((resolve, reject) => { setTimeout(resolve, 500, "one"); }); const promise2 = n
インターフェースを実装する (たぶん必須) ルーティングの遷移時において、非同期処理を挟みたいクラスに、OnActivateとOnDeactivateインターフェースを指定。すると、routerOnActivate()メソッドとrouterOnDeactivate()メソッドの実装が義務付けられます。これがルーティング時のライフサイクルイベントとなります。 import {OnActivate} from "angular2/router"; import {OnDeactivate} from "angular2/router"; import {ComponentInstruction} from "angular2/router"; class ほげほげくらす implements OnActivate, OnDeactivate { /** 遷移で入ってきたとき */ router
Posted on 2015-06-14 Closures: Elixir vs. Ruby vs. JavaScript Closures are not the same across languages. Learn how they differ between Ruby, JavaScript and Elixir to avoid bugs and confusion. tl;dr Closures in Elixir prevent nasty side-effects. Closures in JavaScript are the worst of the three (suprirse, surprise!). Ruby is slightly better thanks to functional elements in the language, but not pe
The focus of this guide is to help developers learn how to secure an Angular application by implementing user authentication. You'll enhance an Angular starter application to practice the following security concepts: Add user login and logout.Retrieve user profile information.Protect application routes.Call an API with protected endpoints.This tutorial uses the Auth0 Angular SDK to secure Angular
通常、await は Promise を expression として渡して、プロミスをアンラップするために使用します。await を用いると、プロミスが決定(つまり、履行または拒否)されるまで、その周囲にある async 関数の実行が一時的に停止されます。実行が再開されると、await式の値は履行されたプロミスの値になります。 プロミスが拒否された場合、await 式は拒否された値で例外を発生します。await 式を格納した関数は、エラーのスタックトレースに表示されます。それ以外の場合、拒否されたプロミスが待機されなかったり、すぐに返されたりすると、呼び出し側の関数はスタックトレースに現れません。 expression は Promise.resolve() と同じように解決されます。常に ネイティブの Promise に変換され、待ち受けされます。もし expression が以下の場
この記事は bouzuya's RxJS Advent Calendar 2015 の 9 日目かつ RxJS Advent Calendar 2015 の 9 日目です。 はじめに 今日は ReactiveX の Observable Utility Operators について RxJS の API ドキュメントやサンプルコードを書いていきます。 また RxJS 4.0.7 を対象にしています。 Observable Utility Operators Observable.prototype.subscribe ReactiveX - Subscribe operator Observable.prototype.subscribe API Document Observable.prototype.subscribe Source Code リスト上は subscribe が挙げら
import React from 'react' import ReactDom from 'react-dom' import { createStore, applyMiddleware } from 'redux' import { createEpicMiddleware } from 'redux-observable' import { connect, Provider } from 'react-redux' // rxjsハマり部分。後述 import 'rxjs/add/operator/mapTo' import 'rxjs/add/operator/filter' import 'rxjs/add/operator/delay' // sampleにあるreducer const pingReducer = (state = { isPinging: false
JavaScriptでWEBプログラミングをしていると、同期処理、非同期処理が混じるのでややこしい。 例えば、同期処理が三つ続く場合だと、順番に処理が進む。 これは普通の処理だ。 一方、非同期処理が混じると、処理1から実行された非同期処理2が実行中にもかかわらず同期処理3に行ってしまう。 まあ、これで問題ない場合もあるが、同期処理3が非同期処理2の結果を利用する場合には、これでは問題が起こる。 つまり、同期処理3を開始する時点で、非同期処理2が完了している事が保証されないからだ。 この記事ではJavaScriptのPromiseの機能を使って非同期処理の完了を待ってから次の同期処理を実行する手法を紹介したい。 同期処理が非同期処理の結果を使う典型的な例 例えば、以下のようなhtmlだと [クリック] ボタンが表示される。 <button onclick="func1()">クリック</bu
Pt — A code experiment on point, form, and space.Reactive Extensions for JavaScript (RxJS) is a reactive streams library that allows you to work with asynchronous data streams. RxJS can be used both in the browser or in the server-side using Node.js. In this post we are going to introduce RxJS basic concepts and how we can use them with AngularJS. Follow me on Twitter for latest updates @gerardsan
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く