<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Le blog de Hinault Romaric Donfack &#187; Rx</title>
	<atom:link href="https://blog.developpez.com/lilroma/pcategory/net/rx/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/lilroma</link>
	<description>Bienvenue sur ce blog. Vous y trouverez du .NET, du .NET...  encore du .NET, toujours du .NET et très peu de chose sur moi</description>
	<lastBuildDate>Sat, 27 Aug 2016 14:24:30 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>[RxJS]Reactive extensions for JavaScript : Saisie semi-automatique avec l&#8217;API Bing</title>
		<link>https://blog.developpez.com/lilroma/p9053/net/rxjs_reactive_extensions_for_javascript</link>
		<comments>https://blog.developpez.com/lilroma/p9053/net/rxjs_reactive_extensions_for_javascript#comments</comments>
		<pubDate>Mon, 28 Jun 2010 13:56:59 +0000</pubDate>
		<dc:creator><![CDATA[Hinault Romaric]]></dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Rx]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[&#160; Ce weekend étant un peu libre je me suis une fois de plus pencher sur les reactive extensions for JavaScript(RxJS) et j’ai essayé de pousser le bouchon un peu plus loin dans la maitrise de cette bibliothèque. Ayant été &#8230; <a href="https://blog.developpez.com/lilroma/p9053/net/rxjs_reactive_extensions_for_javascript">Lire la suite <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>&#160; Ce weekend étant un peu libre je me suis une fois de plus pencher sur les reactive extensions for JavaScript(RxJS) et j’ai essayé de pousser le bouchon un peu plus loin dans la maitrise de cette bibliothèque. Ayant été très impressionné par la présentation d’Erik Meijer et les démos visionnées sur <a href="http://channel9.msdn.com/tags/Rx/">channel9</a> ainsi que celle&#160; présenté par Matthew Podwysocki&rsquo;s. sur son <a href="http://">blog</a>, j’ai décidé que mon expérience sur RxJS ne devait pas être limité à l’unique exemple introductif que j’ai fait jusqu’ici.</p>
<p><span id="more-26"></span></p>
<p>En me basant des exemples rencontrés jusqu’ici j’ai donc essayé d’utiliser RxJS dans un cas simple d’auto-complexion(saisie semi-automatique) lors de la saisie dans une zone de texte en utilisant une source de données distante (Bing). Mais avant d’entrer dans le vif du sujet revoyons les différents billets postés sur le sujet sur ce blog jusqu’ici:</p>
<p>- Dans notre premier <a href="http://blog.developpez.com/lilroma/p8949/net/premier-pas-avec-reactive-extensions-rx/">billet</a> nous avons fait un premier pas avec reactive extensions for.net,&#160; nous avons décrit les collections observable et observer et pour finir on à fait notre premier programme <strong>WPF</strong> drag and drop avec Rx for .net.</p>
<p>- Dans le second <a href="http://blog.developpez.com/lilroma/p9003/net/introduction-aux-reactives-extension-for/">billet</a> sur le sujet nous avons introduit les RxJS et nous avons fait un exemple simple de défilement de texte en fonction de la position de la souris.</p>
<p>&#160;</p>
<p>&#160; Maintenant que nous avons revue les billets introductive sur Rx lançons nous directement dans notre exemple, pour cella nous devons dans un premier temps nous familiariser avec l’API bing http://msdn.microsoft.com/en-us/library/dd251056.aspx qui sera utilisé dans notre exemple.</p>
<p>Ensuite nous devons constituer l’URL pour interroger Bing qui aura la structure suivante:</p>
<blockquote>
<p>http://api.bing.net/json.aspx?AppId=Appid&#038;Query=query&#038;Sources=Spell+web&#038;Version=2.0&#038;Market=en-us&#038;JsonType=raw</p>
</blockquote>
<p>Ou APPid est l’id que nous allons obtenir en nous inscrivant sur  <a href="http://www.bing.com/developers/createapp.aspx">http://www.bing.com/developers/createapp.aspx</a> </p>
<p>et query est la requête que nous allons effectuer </p>
<p>par exemple je peut interroger bing sur le nom benjamin sur le portail us. en saisissant l’url suivante<br />
http://api.bing.net/json.aspx?AppId=Appid&amp;Query=benjamin&amp;Sources=Spell+web&amp;Version=2.0&amp;Market=en-us&amp;JsonType=raw  avec mon Appid dans mon navigateur j’obtiens les données suivantes au format JSON:</p>
<blockquote>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">{<span style="color: #006080">&quot;SearchResponse&quot;</span>:{<span style="color: #006080">&quot;Version&quot;</span>:<span style="color: #006080">&quot;2.0&quot;</span>,<span style="color: #006080">&quot;Query&quot;</span>:{<span style="color: #006080">&quot;SearchTerms&quot;</span>:<span style="color: #006080">&quot;benjamin&quot;</span>},<br /><span style="color: #006080">&quot;Web&quot;</span>:{<span style="color: #006080">&quot;Total&quot;</span>:46300000,<span style="color: #006080">&quot;Offset&quot;</span>:0,<span style="color: #006080">&quot;Results&quot;</span>:[<br />{<span style="color: #006080">&quot;Title&quot;</span>:<span style="color: #006080">&quot;Benjamin - Wikipedia, the free encyclopedia&quot;</span>,<span style="color: #006080">&quot;Description&quot;</span>:<span style="color: #006080">&quot;Benjamin (Hebrew: &#1489;&#1460;&#1468;&#1504;&#1456;&#1497;&#1464;&#1502;&#1460;&#1497;&#1503;, Modern Binyamin Tiberian Biny&#257;mîn &#1489;&#1460;&#1468;&#1504;&#1456;&#1497;&#1464;&#1502;&#1460;&#1497;&#1503;) was the last-born of Jacob 's twelve sons, and the second (and last) son of ...&quot;</span>,<span style="color: #006080">&quot;Url&quot;</span>:<span style="color: #006080">&quot;http:\/\/en.wikipedia.org\/wiki\/Benjamin&quot;</span>,<span style="color: #006080">&quot;DisplayUrl&quot;</span>:<span style="color: #006080">&quot;en.wikipedia.org\/wiki\/Benjamin&quot;</span>,<span style="color: #006080">&quot;DateTime&quot;</span>:<span style="color: #006080">&quot;2010-06-20T10:40:28Z&quot;</span>},<br />{<span style="color: #006080">&quot;Title&quot;</span>:<span style="color: #006080">&quot;Bob and Carolin Benjamin - Keller Williams Integrity First Realty&quot;</span>,<span style="color: #006080">&quot;Description&quot;</span>:<span style="color: #006080">&quot;Gold Canyon Arizona homes in East Phoenix Arizona. Check today for Arizona foreclosures homes. Search Phoenix MLS. Benjamin Realty and The Benjamin Team are real estate agents to ...&quot;</span>,<span style="color: #006080">&quot;Url&quot;</span>:<span style="color: #006080">&quot;http:\/\/benjamin.com\/&quot;</span>,<span style="color: #006080">&quot;DisplayUrl&quot;</span>:<span style="color: #006080">&quot;benjamin.com&quot;</span>,<span style="color: #006080">&quot;DateTime&quot;</span>:<span style="color: #006080">&quot;2010-06-24T11:18:41Z&quot;</span>},<br />{<span style="color: #006080">&quot;Title&quot;</span>:<span style="color: #006080">&quot;Benjamin Franklin - Wikipedia, the free encyclopedia&quot;</span>,<span style="color: #006080">&quot;Description&quot;</span>:<span style="color: #006080">&quot;Benjamin Franklin (January 17, 1706 [O.S. January 6, 1705 [1]] – April 17, 1790) was one of the Founding Fathers of the United States. A noted polymath, Franklin was a leading ...&quot;</span>,<span style="color: #006080">&quot;Url&quot;</span>:<span style="color: #006080">&quot;http:\/\/en.wikipedia.org\/wiki\/Benjamin_Franklin&quot;</span>,<span style="color: #006080">&quot;DisplayUrl&quot;</span>:<span style="color: #006080">&quot;en.wikipedia.org\/wiki\/Benjamin_Franklin&quot;</span>,<span style="color: #006080">&quot;DateTime&quot;</span>:<span style="color: #006080">&quot;2010-06-23T06:55:00Z&quot;</span>},<br />{<span style="color: #006080">&quot;Title&quot;</span>:<span style="color: #006080">&quot;Gisele, Tom Brady Christen Baby Benjamin - omg! news on ...&quot;</span>,<span style="color: #006080">&quot;Description&quot;</span>:<span style="color: #006080">&quot;Gisele, Tom Brady Christen Baby Benjamin - Get your daily celebrity dish on omg 'Everyone was passing Benjamin around and doting on him,' a ...&quot;</span>,<span style="color: #006080">&quot;Url&quot;</span>:<span style="color: #006080">&quot;http:\/\/omg.yahoo.com\/news\/gisele-tom-brady-christen-baby-benjamin\/42784&quot;</span>,<span style="color: #006080">&quot;DisplayUrl&quot;</span>:<span style="color: #006080">&quot;omg.yahoo.com\/news\/gisele-tom-brady-christen-baby-benjamin\/42784&quot;</span>,<span style="color: #006080">&quot;DateTime&quot;</span>:<span style="color: #006080">&quot;2010-06-24T09:09:50Z&quot;</span>},<br />{<span style="color: #006080">&quot;Title&quot;</span>:<span style="color: #006080">&quot;Benjamin&quot;</span>,<span style="color: #006080">&quot;Description&quot;</span>:<span style="color: #006080">&quot;Cyber encyclopedia of Jewish history and culture that covers everything from anti-Semitism to Zionism. It includes a glossary, bibliography of web sites and books, biographies ...&quot;</span>,<span style="color: #006080">&quot;Url&quot;</span>:<span style="color: #006080">&quot;http:\/\/www.jewishvirtuallibrary.org\/jsource\/biography\/benjamin1.html&quot;</span>,<span style="color: #006080">&quot;DisplayUrl&quot;</span>:<span style="color: #006080">&quot;www.jewishvirtuallibrary.org\/jsource\/biography\/benjamin1.html&quot;</span>,<span style="color: #006080">&quot;DateTime&quot;</span>:<span style="color: #006080">&quot;2010-06-22T16:28:51Z&quot;</span>},<br />]}}}</pre>
<p></div>
</blockquote>
<p>Il est à noter que les données sont aussi disponible au format XML et SOAP</p>
<p>Maintenant que nous avons la structure des données retournées, nous pouvons créer un appel à l’API AJAX basée sur un mandat et sélectionner l’élément “title” de notre résultat, pour cella RxJS contient la méthode XmlHttpRequest donc le constructeur à deux surcharges, l’une qui prend une chaine simple qui est l’URL et l’autre qui prend un XmlHttpRequestDetails qui contient les détails de la requête web.</p>
<p>La signature de la méthode est la suivante:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 109px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">function XmlHttpRequest(<br />    url);    <span style="color: #008000">// url de la requete</span><br /><br />function XmlHttpRequest(<br />    details); <span style="color: #008000">// details de l'instance XmlHttpRequest    </span><br /><br /></pre>
<p></div>
</p>
<p>&#160;</p>
<p>Maintenant écrivons notre fonction BinSearch qui prend en paramètre le terme de notre recherche et créer un XmlHttpRequest pour Bing et retourne le résultat approprié formaté, pour cella nous allons appeler la méthode Rx.Observable.XmlHttpRequest et retourner l&rsquo;élément Title dans notre document JSON</p>
<p>&#160;</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 220px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #0000ff">function</span> Bingsearch(query) {<br />    <span style="color: #0000ff">var</span> url = <span style="color: #006080">&quot;http://api.bing.net/json.aspx?AppId=AppId&amp;Query=&quot;</span>+query+<br />    <span style="color: #006080">&quot;&amp;Sources=Spell+web&amp;Version=2.0&amp;Market=en-us&amp;JsonType=raw&quot;</span>&quot;;<br />    <br />    <span style="color: #0000ff">return</span> Rx.Observable.XmlHttpRequest(url)<br />        .Select(<span style="color: #0000ff">function</span>(result) {<br />            <span style="color: #0000ff">var</span> response = eval(result.Web.Results);<br /> <span style="color: #0000ff">return</span> response.Title;<br />                    });<br />}</pre>
<p></div>
<p>Maintenant, nous allons insérer une zone de saisie de sorte que lorsqu’une valeur est saisie nous déclenchons une recherche sur bing</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 111px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span><br />    <span style="color: #0000ff">&lt;</span><span style="color: #800000">input</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;searchInput&quot;</span> <span style="color: #ff0000">size</span><span style="color: #0000ff">=&quot;100&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text&quot;</span> <span style="color: #0000ff">/&gt;</span><br />    <span style="color: #0000ff">&lt;</span><span style="color: #800000">ul</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;results&quot;</span> <span style="color: #0000ff">/&gt;</span><br /><br /><span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span></pre>
<p></div>
<p>&#160;</p>
<p>&#160; Lorsque le document se charge, nous devons être capable de suivre l’événement <strong>KeyUp</strong> de notre zone de rechercher et ensuite afficher notre résultat. Pour cella nous devons envelopper cette fonctionnalité dans la fonction <strong>document.ready</strong>.</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 80px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">$(document).ready(<span style="color: #0000ff">function</span>() {<br />   <br />});</pre>
<p></div>
<p>&#160; Ensuite nous devons écouter l’événement <strong>KeyUp</strong> de notre zone de recherche.</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 64px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #0000ff">var</span> searcher = $(<span style="color: #006080">&quot;#searchInput&quot;</span>)<br />    .ToObservable(<span style="color: #006080">&quot;keyup&quot;</span>)</pre>
<p></div>
<p>&#160; maintenant on récupère la valeur saisie dans notre zone de recherche.</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 66px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">.Select(<span style="color: #0000ff">function</span>(_) {<br />      <span style="color: #0000ff">return</span> $(<span style="color: #006080">&quot;#searchInput&quot;</span>).val(); })</pre>
<p></div>
</p>
</p>
<p>&#160;</p>
<p>&#160;&#160; Pour éviter d’effectuer énormément de requête sur Bing nous allons définir un interval de temps d’attente avant d’effectuer une nouvelle requête sur Bing. pour notre cas nous allons utiliser 300 millisecondes comme intervalle de temps.</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 50px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">. Throttle(300)</pre>
<p></div>
<p>&#160; Ensuite on va appeler notre fonction Bingsearch.</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; height: 62px; background-color: #f4f4f4; text-align: left; border-bottom-style: none">.Select(<span style="color: #0000ff">function</span>(query) {<br />        <span style="color: #0000ff">return</span> Bingsearch(query); })<br />.Switch();</pre>
<p></div>
</p>
<p>Le code complet pour créer notre séquence observable sur bing et retourné notre résultat .</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 169px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #0000ff">var</span> searcher = $(<span style="color: #006080">&quot;#searchInput&quot;</span>)<br />    .ToObservable(<span style="color: #006080">&quot;keyup&quot;</span>)<br />    .Select(<span style="color: #0000ff">function</span>(_) {<br />        <span style="color: #0000ff">return</span> $(<span style="color: #006080">&quot;#searchInput&quot;</span>).val(); })<br />    .Throttle(300)<br />    .Select(<span style="color: #0000ff">function</span>(quey) {<br />        <span style="color: #0000ff">return</span> Bingsearch(query); })<br />    .Switch();</pre>
<p></div>
</p>
<p>Et pour finir, nous pouvons souscrire à notre séquence observable et mètre à jour les données retournées par Bing.</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 160px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">searcher<br />    .Subscribe(<br />        <span style="color: #0000ff">function</span>(data) {<br />            $(<span style="color: #006080">&quot;#results&quot;</span>).empty();<br />            $.each(data, <span style="color: #0000ff">function</span>(_, value) {<br />                $(<span style="color: #006080">&quot;#results&quot;</span>).append(<span style="color: #006080">&quot;&lt;li&gt;&quot;</span>+value+<span style="color: #006080">&quot;&lt;/li&gt;&quot;</span>);<br />            });<br />        },</pre>
<p></div>
<p>  Et voila un aperçu du résultat que nous pouvons obtenir</p>
<p><img src="http://blog.developpez.com/media/binsearch.PNG" width="407" height="109" alt="img1" /></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
