<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jean-Baptiste PIN on Medium]]></title>
        <description><![CDATA[Stories by Jean-Baptiste PIN on Medium]]></description>
        <link>https://medium.com/@jbpin?source=rss-3906865ad41a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*C77DZBf_dD0E1CdJ.jpg</url>
            <title>Stories by Jean-Baptiste PIN on Medium</title>
            <link>https://medium.com/@jbpin?source=rss-3906865ad41a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 14:31:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jbpin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[In helping us to build a community art gallery, you will get free tokens to invest in new artists.]]></title>
            <link>https://medium.com/pixinch/in-helping-us-to-build-a-community-art-gallery-you-will-get-free-tokens-to-invest-in-new-artists-f152c552a451?source=rss-3906865ad41a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f152c552a451</guid>
            <category><![CDATA[digital-art]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[ico]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Jean-Baptiste PIN]]></dc:creator>
            <pubDate>Sun, 11 Mar 2018 16:35:50 GMT</pubDate>
            <atom:updated>2018-03-11T19:32:16.974Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X76kma7tTbioUlyrF24-Mg.jpeg" /></figure><p>We are proud to annonce that our Airdrop campaign is open ! You are invited to share this great news with your community. How ? Just create a great post on social network (Twitter, Facebook, Instagram, Pinterest, Dribbble, etc.) showcasing the work of an artists you like (source can be <a href="https://ello.co/discover/illustration">ello</a>, <a href="https://dribbble.com/">dribbble</a>, <a href="https://www.behance.net/">behance</a>, or any other website and blog). Attach a link to our website so that your friends can participate: <a href="https://ico.pixinch.com/">https://ico.pixinch.com</a></p><p>Then fill up the form at <a href="https://docs.google.com/forms/d/12-ZJNxmHQNpmwxXN0RsFGDvzYGgX4EaHQX3Sew63koM">https://docs.google.com/forms/d/12-ZJNxmHQNpmwxXN0RsFGDvzYGgX4EaHQX3Sew63koM</a> to qualify to receive 100 free PIN token, worth $20USD.</p><p>Everyday until the end of the operation (Friday, March 16) we will package all the posts in an art gallery that will be shared in our channels to make a tribute to digital artists you picked.</p><p>Here are our firsts Daily Pixinch Art Gallery :)</p><h3>Pixinch Art Gallery</h3><p>Here are artists showcased by our community. We will build an art gallery of digital Artists. Be sure to participate @ https://ico.pixinch.com and (instruction and form availhttps://docs.google.com/forms/d/12-ZJNxmHQNpmwxXN0RsFGDvzYGgX4EaHQX3Sew63koM</p><h3>Pixinch Art Gallery #2</h3><p>Here are artists showcased by our community. We will build an art gallery of digital Artists. Be sure to participate @ https://ico.pixinch.com and (instruction and form available at</p><h3>Pixinch Art Gallery #3</h3><p>Be sure to participate to get free #tokens https://ico.pixinch.com</p><p>Please help us to spread the word and let’s build together a huge tribute to artists.</p><p>Nous sommes fier de vous annoncer que la campagne promotionnelle d’ “Airdrop” de tokens Pixinch est ouverte ! Nous vous invitons à partager cette bonne nouvelle avec votre communauté.</p><p>Pour cela, partagez un posts sur votre réseau social favori (Twitter, Instagram, Facebook, Pinterest, Dribbble etc.) mettant en avant l’oeuvre d’un artiste qui vous plaît (la source peut venir de <a href="https://ello.co/discover/illustration">ello</a>, <a href="https://dribbble.com/">dribbble</a>, <a href="https://www.behance.net/">behance</a>, ou n’importe quel autre site ou blog sur l’art digital). Insérez un lien vers notre site web (https://ico.pixinch.com) pour que vos amis puissent aussi participer.</p><p>Ensuite nous vous invitons à remplir <a href="https://docs.google.com/forms/d/12-ZJNxmHQNpmwxXN0RsFGDvzYGgX4EaHQX3Sew63koM">ce formulaire</a> pour vous enregistrer et recevoir 100 tokens Pixinch gratuitement (valeur environ 20EUR).</p><p>Jusqu’à la fin de l’opération prévu Vendredi 16 mars à minuit, nous publierons chaque jour une galerie d’art comprenant tout vos posts afin de rendre hommage aux artistes digitaux que vous avez sélectionné (Voir plus haut nos premières galeries).</p><p>Aidez nous à rendre hommage aux artistes digitaux et à construire Pixinch le Netflix de l’Art. Partagez avec vos amis et SVP participez à cette belle initiative.</p><p>Don’t forget to clap and share ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f152c552a451" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixinch/in-helping-us-to-build-a-community-art-gallery-you-will-get-free-tokens-to-invest-in-new-artists-f152c552a451">In helping us to build a community art gallery, you will get free tokens to invest in new artists.</a> was originally published in <a href="https://medium.com/pixinch">pixinch</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The olympics are not over yet. Discover our bonus campaign.]]></title>
            <link>https://medium.com/pixinch/the-olympics-are-not-over-yet-discover-our-bonus-campaign-6d2c9f8f755d?source=rss-3906865ad41a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d2c9f8f755d</guid>
            <category><![CDATA[art]]></category>
            <category><![CDATA[bonus]]></category>
            <category><![CDATA[ico]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Jean-Baptiste PIN]]></dc:creator>
            <pubDate>Tue, 27 Feb 2018 19:01:00 GMT</pubDate>
            <atom:updated>2018-02-27T19:42:16.108Z</atom:updated>
            <content:encoded><![CDATA[<p>Pixinch is a decentralized Netflix for Art.</p><p>Through Pixinch, Artists can register their artworks on the blockchain. All the registered artworks are broadcasted on our platform, accessible by everyone, all around the world.</p><p>Pixinch will evaluate Artists and will assign a quotation for each piece of Art based on their previous sale, their production and their reputation. The quotation will be expressed using our universal currency, the PIN.</p><p>On the other side, Consumer and Collectors can browse the catalog online and display all the registered content on their screen (Tablet, Phone, TV, Computer). When they fall in love with an Artists they can purchase their artworks online and become the official owner and supporter of the Artwork. Backed by blockchain technology, Collectors have access to all the history of Artists and the Artworks, being certain of their investment.</p><p>All the activities in Pixinch are rewarded by our Smart Contract that exists to maintain a stable quotation of the PIN token. Users, Collectors and Artists are rewarded in PIN for investing their time in Pixinch.</p><p>Earning PIN will provide an opportunity to invest in our Investment Fund. Users that opt in the Investment Fund will be paid interest in Fiat Money</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uS5azR3lwBYoX_1h3q6n8A.png" /><figcaption>Pixinch virtuous cycle</figcaption></figure><h3>CryptoColors</h3><p>In order to fund the project we are running an ICO that start today and will end in 45 days.</p><p>To spike interest and build trust during the Pixinch ICO, we built a game based on blockchain technology to demonstrate the tokens lifecycle and our capability to deliver the product.</p><p>We call this game: CryptoColors. Because colors are the main tools of artists, we want to pay tribute to them.</p><p>We are selling 16 777 216 colors. Each one is unique and can be yours, backed by blockchain technology. We are running a bonus campaign limited to a certain number of colors at a discount so be sure to get in early!</p><p>The game will unlock itself when all the colors will be reserved, or at the end of the ICO period. From then, all colors will trade for 0.01ETH, and will double in price every time they are purchased by someone else.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GzhDuqrYfeBFFiqwmD2azQ.png" /><figcaption>Pixinch Olympic Bonus Campaign</figcaption></figure><p>We invite you to connect to our DApp at https://ico.pixinch.com to start the future of digital art.</p><p><em>If you like this post please clap and share on social network.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d2c9f8f755d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixinch/the-olympics-are-not-over-yet-discover-our-bonus-campaign-6d2c9f8f755d">The olympics are not over yet. Discover our bonus campaign.</a> was originally published in <a href="https://medium.com/pixinch">pixinch</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Experimenting NavigationExperimental with Sinux]]></title>
            <link>https://medium.com/@jbpin/experimenting-navigationexperimental-with-sinux-95f3a1750740?source=rss-3906865ad41a------2</link>
            <guid isPermaLink="false">https://medium.com/p/95f3a1750740</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[navigation]]></category>
            <category><![CDATA[navigationexperimental]]></category>
            <category><![CDATA[sinux]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Jean-Baptiste PIN]]></dc:creator>
            <pubDate>Sat, 13 Aug 2016 14:55:44 GMT</pubDate>
            <atom:updated>2016-08-13T14:55:44.597Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m working on a React Native application. I was using react-native-router-flux in order to manage the navigation on the app.</p><p>Unfortunately, this project use an old component that have been fork prior Facebook include ExperimentalNavigation in React-Native.</p><p>So I decided to rewrite a router for my app, using React Native NavigationExperimental and <a href="https://github.com/jbpin/sinux">Sinux</a>. This post assume you are familiar with <a href="https://facebook.github.io/react/">React</a> and <a href="https://facebook.github.io/react-native">React-Native</a>.</p><h3>React-Native Navigation</h3><p>Navigation in React Native app have been in a discuss for a long time. There is plenty of implementation like Navigator, NavigatorIOS. Then they implement a new navigation component : NavigationExperimental.</p><p>See the doc for more details (<a href="https://facebook.github.io/react-native/docs/navigation.html">https://facebook.github.io/react-native/docs/navigation.html</a>)</p><h3>React-Native NavigationExperimental</h3><p>I’ll try to do a simple introduction on NavigationExperimental, but you will find examples accros the web and on Medium.</p><blockquote>NavigationExperimental provides a different approach to navigation, allowing any view to act as a navigation view and using reducers to manipulate state at a top-level object.</blockquote><p>NavigationExperimental is based on several components. The entry point is <em>NavigationCardStack</em> component.</p><p>This components require two props, <em>navigationState</em> which is the current state of the navigation, and a <em>renderScene </em>function that must return a React Element.</p><pre>&lt;NavigationCardStack<br>  navigationState={theNavigationState}<br>  renderScene={funcThatReturnElement}<br>/&gt;</pre><p>Under the hood, <em>NavigationCardStack</em> will handle the state call the <em>renderScene </em>and animate the view.</p><h3>NavigationState structure</h3><p>NavigationState is an object that have two properties, index and routes.</p><pre>NavigationRoute = {<br>  key: string,<br>  title?: string<br>};</pre><pre>NavigationState = {<br>  index: number,<br>  routes: Array&lt;NavigationRoute&gt;,<br>};</pre><p>Index is the current index in the routes array that is display, and routes is an array of <em>NavigationRoute</em> that is composed of a key, a string that identify the view and an optional title.</p><h3>NavigationStateUtils</h3><p>NavigationExperimental come with an helper to manage the mutation of the navigation state.</p><p><em>NavigationStateUtils</em> provide these methods:</p><ul><li>back: Sets the focused route to the previous route.</li><li>forward: Sets the focused route to the next route.</li><li>get: Gets a route by key</li><li>has: Returns `true` at which a given route&#39;s key can be found in the routes of the navigation state.</li><li>indexOf: Returns the first index at which a given route&#39;s key can be found in the routes of the navigation state, or -1 if it is not present.</li><li>jumpTo: Sets the focused route of the navigation state by key.</li><li>jumpToIndex: Sets the focused route of the navigation state by index.</li><li>pop: Pops out a route from the navigation state. Note that this moves the index to the positon to where the last route in the stack is at.</li><li>push: Pushes a new route into the navigation state. Note that this moves the index to the positon to where the last route in the stack is at.</li><li>replaceAt: Replace a route by a key.</li><li>replaceAtIndex: Replace a route by a index.</li><li>reset: Resets all routes.Note that this moves the index to the positon to where the last route in the stack is at if the param `index` isn&#39;t provided.</li></ul><p>The two most used methods or <em>push</em> and <em>pop </em>who respectively add a view in the stack and remove the current view to the stack.</p><h3>renderScene function</h3><p>This function get a <em>props</em> in parameter and return a corresponding <em>React Element</em></p><p>The props is defined as</p><pre>/* NavigationSceneRendererProps */<br>const SceneRendererProps = {<br>  layout: layout.isRequired,<br>  navigationState: navigationState.isRequired,<br>  position: animatedValue.isRequired,<br>  progress: animatedValue.isRequired,<br>  scene: scene.isRequired,<br>  scenes: PropTypes.arrayOf(scene).isRequired,<br>};</pre><p>To get the key of the scene you should return, you can use</p><pre>props.scene.route.key</pre><p>Then as usual return a React Element like in <em>render().</em></p><pre>renderScene(props){<br>  switch(props.scene.route.key){<br>    case &#39;example&#39;:<br>      return (&lt;View /&gt;);<br>      break; <br>    default:<br>      return (&lt;View /&gt;);<br>  }<br>}</pre><h3>Managing NavigationState with Sinux</h3><p>Sinux is a state container for Javascript. You can learn more on Sinux in reading <a href="https://jbpin.gitbooks.io/sinux-a-flux-implementation-based-on-signal/content/">this book </a>.</p><p>Sinux come with three components, Signal, Store and Command.</p><p>Store is the state container. A Store expose Signals. A Command is a function that is executed when a Signal is dispatch.</p><p>In other words, Store signal trigger a Command that mutate the state contains in the store.</p><h3>The NavigationStore</h3><p>The navigationStore will be in charge of the <em>NavigationState.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afceb9163d2d4892d3c54a088d21a36b/href">https://medium.com/media/afceb9163d2d4892d3c54a088d21a36b/href</a></iframe><p>Let’s decompose it.</p><p>The initial state of the store will be a valid empty <em>NavigationState. </em>Then for each method of the <em>NavigationStateUtils</em> we will create a corresponding <em>Store Signal</em></p><pre>const navigationStore = new Store({ index: 0, routes: [] }, ...Object.keys(NavigationStateUtils));</pre><p>Now we must create a Command for all Store Signal. Theses commands will simply forward the call to corresponding NavigationStateUtils method. This is possible because <em>Sinux</em> <em>Command</em> will inject the current state contains in the store as the first parameter of the function. And all <em>NavigationStateUtils</em> method also take state as first parameter.. sometime life is well done ;)</p><pre>for(method in NavigationStateUtils){<br>  new Command(navigationStore[method], NavigationStateUtils[method])<br>}</pre><p>That’s it.</p><h3>NavigationRoot</h3><p>In react-native-router-flux there was a notion of declarative Scene in Router.</p><pre>&lt;Router ...&gt;<br>   &lt;Scene .../&gt;<br>&lt;/Router&gt;</pre><p>I which to keep the same behaviour but avoiding Scene as <em>NavigationCardStack</em> already have this notion embedded (<em>NavigationCard</em>)</p><p>So I want something simple more like</p><pre>&lt;NavigationRouter&gt;<br>  &lt;MyComponent ...&gt;<br>&lt;/NavigationRouter&gt;</pre><p>Then I can use <em>props.children </em>to build scenes.</p><p>Here is the final code for NavigationRouter</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9263f2f430371af9076158ab323ac59b/href">https://medium.com/media/9263f2f430371af9076158ab323ac59b/href</a></iframe><p>This component use the store we created before to manage the <em>NavigationState. </em>When <em>componentWillReceiveProps </em>is called the <em>initNavigation </em>function will go through the children list to create a scene array, which is an array of <em>React Element. </em>RenderScene will retrieve the element referenced by the key.</p><p>In order to be part of the scene array each element should declare a <em>routerKey</em> props. <em>NavigationRoot </em>use <em>initialRoute </em>to call the push signal of the <em>navigationStore</em> and trigger the first <em>Card/Screen</em>.</p><h3>Using navigationStore and NavigationRoot</h3><p>Once you get all your screen configured you can navigate through your app by dispatching <em>navigationStore </em>signals.</p><p>Here is a sample application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0bd8b210b9aa658eefa76097bf3e6b1d/href">https://medium.com/media/0bd8b210b9aa658eefa76097bf3e6b1d/href</a></iframe><h3>react-native-router-sinux</h3><p>I bundle a library that is available on npm (npm i -S react-native-router-sinux).</p><p><a href="https://github.com/jbpin/react-native-router-sinux">https://github.com/jbpin/react-native-router-sinux</a></p><p>The library expose navigationStore and NavigationRoot. Feel free to give it a try.</p><blockquote>I hope you enjoy reading this article. Feel free to like it and share it. Comments are welcome.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95f3a1750740" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why do I write Sinux, a flux inspired library for React Native]]></title>
            <link>https://medium.com/@jbpin/why-do-i-write-sinux-a-flux-inspired-library-for-react-native-80e2ccce031c?source=rss-3906865ad41a------2</link>
            <guid isPermaLink="false">https://medium.com/p/80e2ccce031c</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[sinux]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Jean-Baptiste PIN]]></dc:creator>
            <pubDate>Mon, 28 Dec 2015 18:44:43 GMT</pubDate>
            <atom:updated>2015-12-28T18:51:02.095Z</atom:updated>
            <content:encoded><![CDATA[<h4>Back in 2010, my resume title was Adobe Flex developer. At this time, developers on Adobe technologies were rock stars.</h4><p>Big companies, creative studio’s and web agencies were looking for such profiles. Adobe were doing big conferences all over the world that were the equivalent of Web conferences you can find now.</p><p>If you had been a web developer or a RIA developer during this time, for sure you would have been to one on these conferences and inevitibly worn a t-shit with the Adobe logo on it (no kidding).</p><p>With Flex and AIR you could have built an app for a wide range of devices. Web, Native app, TV, phone but sadly, not watches… yet..</p><h3>Adobe Flash Platform</h3><p>MVC framework were starting to emerge from the community, so far I can remember a few of them were trending but I can remember one in particular.</p><p>The last application (MySnapper) I developed in AS3 was a Flex/AIR cross platform native application that uses Robotlegs.</p><p>Then came HTML5 and CSS3 with video and sound support, iOS with their no flash policy and eventually Adobe sacrificed Flex and gave it to <a href="https://www.google.fr/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;uact=8&amp;ved=0ahUKEwjRteavjvnJAhVEVxoKHR7TAGkQFgggMAA&amp;url=http%3A%2F%2Fflex.apache.org%2F&amp;usg=AFQjCNEyvd07BHAiofkX4V0RUBDqXKhEwQ&amp;sig2=OqNkfrt7dCSJZnsv92Qh6w">Apache</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*WhVzAsv1mSH8aeNrOs-VLw.jpeg" /><figcaption>Abode Flash Platform</figcaption></figure><h3><strong>React Native and Redux</strong></h3><p>I’m still a developer and I follow the move, flipping from AS3/Flex/Air to HTML5/CSS3/Js. I used jQuery for years, then Angular, and eventually tried Backbone, EmberJs etc.. I did web development as mobile hybrid application using Cordova.</p><p>A few months ago, I started a new project and I discovered React Native. This was just what I was looking for to jump on React. I watched conferences on the subject, read tons of articles on React, Web components, es6, flux architecture.</p><p>I was ready to start, I got my stack, my plan and all the confidence you need when deciding to go for a technology that is quiet new.</p><p>I managed to define three main behavioural qualities:</p><ul><li>Asynchronous call</li><li>Side Effect</li><li>Optimistic UI</li></ul><p>I was ready to use Redux, I found it clear, easy to develop and test, with a large support base and an active development. But React 0.16 was shipped with Babel6, and I wanted to use ECMAScript 2015, as they will probably not be rolling back on Facebook. React-Redux was not ready to support React Native 0.16 (BTW, Facebook is working on an issue that should solve this so it will soon become an old story).</p><p>Another thing came to mind. I was a bit upset having to create a long list of constants for defining which actions I need to use in my application. I knew it was an issue in AS3 but I was not crossing this bridge at present.</p><h3><strong>Asynchronous call</strong></h3><p>The app will have to use several API and asynchronous calls, also all the business logics will have to stand in one layer. In action or reducer, or wherever it will make sense. Action doesn’t make sense to me. They are just something happening in the system. Some action creators return objects, others return functions. It was not consistent.</p><p>I need to have a way to watch for an asynchronous action so that I can have indicators regarding the state of the call rather than having to maintain a state in my store.</p><h3><strong>Promise/Generator/Yield</strong></h3><p>ES6 comes with Promise, Function generator with yielding. There is ES7 coming with async/await pattern. It was obvious to me that there was a path to follow in order to undertake an asynchronous call.</p><p>For most of the time I was looking for my stack, I was looking for a way to put my business logics in a layer that would be clear for everyone in my team where to find them.</p><p>I was not happy with putting them in actions, nor in Store as suggested by the Facebook documentation. I needed something granular. I also wanted to use new features like Promises and Generator function.</p><p>I found a project called <a href="https://github.com/yelouafi/redux-saga">redux-saga</a> that allowed me to handle side effect using function generator.</p><p>It was clearly known that I wanted to use Generator Function or a similar pattern.</p><p>I finally found <a href="https://github.com/tj/co">tj/co</a>. It’s a library write by TJ Holowaychuk :</p><p><em>“Generator based control flow goodness for nodejs and the browser, using promises, letting you write non-blocking code in a nice-ish way.</em>”</p><p>With co I can yield almost anything :</p><ul><li>function</li><li>promises</li><li>thunks (functions with callback)</li><li>array or objects for parallel execution</li><li>generators and generator functions</li></ul><p><em>“Nested ‘yieldable’ objects are supported, meaning you can nest promises within objects within arrays, and so on!”</em></p><h3><strong>Signal</strong></h3><p>Here is a rough comparaison of Signals over Events</p><p>Events:</p><ul><li>Rely on String</li><li>Single dispatcher</li><li>All listeners will receive events the same if they do not process it</li><li>Type/Class less</li><li>Data is passed by using payload</li></ul><p>Signals:</p><ul><li>Rely on Object</li><li>Self dispatching</li><li>Only listeners attached to the signal will be called</li><li>Listeners (Command) have a signature</li></ul><p>Events over Signals in Flux mean having a bench load of listeners to be called every time an action is dispatched. I also need to know the name of the event I want to process or fire. To be sure I will not misspell its name, I can use constants, so by having a bench load of constants to maintain, I am not sure that I will not duplicate one. Afterall, working alone on a project is challenging but in a bigger team it becomes a nightmare.</p><p>With signal, I got an object that dispatched itself and called all the attached listeners. All listeners have a signature and so I can handle any error and fail gently and effectively. I can also pass them through the app, between stores etc.</p><p>I’m not relying on String anymore, and more importantly, I am not misspelling their names or duplicate them. Also, having them to rely on object means I don’t have to worry about removing listener in a single point (dispatcher) and thus avoiding memory leaks.</p><h3><strong>Sinux</strong></h3><p>Back to my stack, I start thinking on how I can use Signal for triggering business logic element that reside in one layer and use Promise or Generator function with the co library.</p><p>I remember the time I was developing in AS3 using Robotlegs. We use signals that were injected into a view mediator/presentation model, and views were plugged to the mediator or presentation model and injected into it. Signal’s dispatch method was called and a command was triggered. In that way view were decoupled from the data. I find it very intelligent and easy to maintain.</p><p>I want something similar and simple to test. I start creating a class for Store with basic function (updateState, getState) and Signal class simple as well (dispatch, addListener, removeListener). Now I have to pair this element and have a business layer to handle actions. I create a Command class with only one method ; execute.</p><p>Finally, I am able to create stores, signals and commands. Signal are simple objects that hold listeners (commands) that update the stores when they finish processing. Here is how I came to attach Signal to Store. When creating a Store, store will create and hold Signals and in doing so, will be responsible for them.</p><pre>var userStore = new Store({}, ‘create’, ‘login’, ‘logout’, ‘update’, …)</pre><pre>new Command(userStore.create, function* (username, email, password){<br> try{ <br>   let result = yield api.createUser(username, email, password)<br>   return result.user<br> }catch(e){<br>   …<br> }<br> }())</pre><pre>new Command(userStore.create, function* (username, email, password){<br>   analytic.event(‘user created’, {username, email})<br>}())</pre><pre>new Command(userStore.update, function(userId, user) {<br>  return new Promise((resolve, reject) =&gt; {<br>    api.updateUser(userId, user, (result, err) =&gt; {<br>      if(err){<br>        return reject(err)<br>      }<br>        resolve(result.user)<br>      }<br>    )<br>  )<br>})</pre><p>In the same way, commands can be executed without depending on store.</p><pre><br>let action = new Signal(&#39;action&#39;) </pre><pre>new Command(action, (...args){<br>  ...<br>}<br></pre><p>Each command can be defined in a separate file and loaded on the application entry point.</p><pre>MySinuxApp<br> | — store<br> | — — user.js<br> | — command<br> | — — user<br> | — — — login.js<br> | — — — update.js<br> | — api.js<br> | — index.js</pre><p>You can find a link to an example react-native todo app in the repos of the project <a href="https://github.com/jbpin/sinux">jbpin/sinux</a></p><p>Each Signals is dispatch using the store instance.</p><p><em>userStore.udpate(1, {username: jbpin, ..})</em></p><p>You can pass signals in command as an argument and because dispatch returned a promise you can also yield for them (waitFor behavior).</p><p>When dispatching a signal from a container, you can update the state of sub components and listen for the promise ending to restore the state. By using this method, you can manage ActivityIndicator and other systems.</p><h3><strong>Conclusion</strong></h3><p>I’m now using Sinux in my project, it’s a young project and I don’t have much feedback to give. There is still work to be done on reproducing some of redux middleware and tools. Please feel free to download it and try it. I’m looking for feedback on your experiments. I’m also looking for contributors to improve and maintain the project. Feel free to get in touch <a href="https://medium.com/u/3906865ad41a">Jean-Baptiste PIN</a> (@jbpin) on twitter or in the <a href="https://gitter.im/jbpin/sinux">gitter</a> of the project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80e2ccce031c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>