The post Almightree : jQuery Large Nested Lists Plugin appeared first on jQuery Rain.
by Admin via jQuery Rain
"Mr Branding" is a blog based on RSS for everything related to website branding and website design, it collects its posts from many sites in order to facilitate the updating to the latest technology.
To suggest any source, please contact me: Taha.baba@consultant.com
A jQuery plugin which makes large nested lists easier to navigate.
The post Almightree : jQuery Large Nested Lists Plugin appeared first on jQuery Rain.
Welcome to our weekly edition of what’s hot in social media news. To help you stay up to date with social media, here are some of the news items that caught our attention. What’s New This Week Snapchat Introduces Memories Feature: “Memories is a new way to save Snaps and Stories on Snapchat.” This new [...]
This post Snapchat Memories Allows Republishing of Content: This Week in Social Media first appeared on .
- Your Guide to the Social Media Jungle
After ecommerce and social media, the next big thing has arrived - internet-enabled devices or the Internet of Things - and WordPress is ready to embrace it with both arms.
This revolutionary paradigm shift is set to transform every aspect of our lives, from optimizing our homes to the way we travel. Though the Internet of Things has already made its way into home automation, it hasn’t quite taken off with WordPress integration.
The Internet of Things creates value from gathering data and leveraging it in real time. WordPress and the Internet of Things can work together in a sensor-to-machine relationship (where WordPress is the sensor) to increase productivity, make processes more efficient, and analyze data without employing additional, complex machinery. With this in mind, in this post, we’re going to look at the Internet of Things from a WordPress standpoint and how it will allow our websites to communicate with devices in order to make the Internet of Things WordPress-smart.
Let’s put everything into context before we get started.
Continue reading %Integrating WordPress with the Internet of Things%
This article is part of a web development series from Microsoft. Thank you for supporting the partners who make SitePoint possible.
Unlike frameworks such as AngularJS and Ember, React is a library that provides a limited number of functions, and is largely agnostic with respect to the libraries that are used for other aspects of the application. Fundamentally, React provides UI component functionality, whereby it provides a mechanism to create components, manage data within components, render components, and compose components to build larger components. React can be used regardless of where data comes from, how it's retrieved, or how it's managed as part of a larger application. To attack these issues, other libraries and patterns are utilized. One common pattern used with React applications is Flux.
Flux was developed as an alternative to the MVC (model-view-controller) pattern for managing the flow of data in response to actions. Unlike MVC’s bi-directional flow of data, Flux relies upon a unidirectional flow of data between the various parts of the system. Flux was created by Facebook because their developers found it difficult to reason about the movement of data within massive applications which employed MVC.
Instead of MVC’s multiple circuits of data flow, Flux uses a single circuit of data flow. The flow runs in continuous cycle of Action -> Dispatcher -> Store (or multiple stores) -> Component (aka View) -> Action.
The action represents some kind of event which enters the system. It could be user-generated, such as a button click requesting a refresh of data, or it could be a message received over a web socket. The action is passed to the dispatcher which sends it to all of the stores. The dispatcher is really nothing more than a forwarding mechanism. It understands nothing about the action, the data being passed by the action, nor the responsibilities or interests of each store concerning the action. It simply dispatches the action to all stores, and then each store chooses whether or not it should process the action. The stores are responsible for maintaining a local copy of the data, enforcing business rules, and notifying components of new data so they can be refreshed. The stores can be thought of as maintaining the application state, and the overall Flux process is essentially a state machine. React Components utilize a state machine pattern. In a sense, Flux utilizes this same state machine pattern for the architecture of the entire application.
While Flux is a pattern for solving the problem of the data flow, it does not itself provide an implementation of that pattern. To use the Flux pattern, developers are forced to create all of the components of the system, except for the dispatcher which is provided by Facebook. Creating a Flux system is relatively easy, but it requires a lot of boilerplate code. In this regard, it suffers from the same problem as Backbone.js. It’s easy to get up and running, but lots of coding is ultimately required.
As developers worked with Flux, they began to find ways to refactor boilerplate code into reusable libraries. In addition, they identified subpatterns of Flux which made reasoning about an application’s data flow easier, and reduced the complexity of the application without sacrificing the general benefits of Flux. These subpatterns included reducing the application from many stores to one, combining the dispatcher and store into the same component (which makes sense when there is only one store), and wrapping components in a container which handles action creation, dispatching, and store management in a black box. The Flux derivatives were not purely Flux, but they retained its essential elements without the usual disadvantage of Flux, namely lots of boilerplate code.
While there are many derivatives of Flux, Redux is one of the more popular ones. Redux is built purely around the concept of a state machine and immutable data, where actions are handled by a single dispatcher-store which uses reducer functions (which themselves are composable) to transition from one state to another. It greatly simplifies Flux, while introducing many aspects of functional programming, which, once mastered, make coding React applications much easier.
Relay is another Flux derivative from Facebook which is growing in popularity. For information about how Facebook is using Relay, and their thoughts on its relation to Flux, click here.
While Redux simplified the management of the application, it is agnostic regarding the location of the actual data. It can work with any data storage system, once again leading to more boilerplate code (albeit less than with Flux). Now comes Relay (another Facebook creation–they have been busy in the JavaScript space–React, Relay, Immutable.js, GraphQL, Jest, Flow, etc.), which seeks to refactor away the boilerplate code for data access as well as including the introduction of a new kind of data service–GraphQL. GraphQL differs from traditional REST services in that it views data as a graph, and seeks to represent that graph in a hierarchical form, allowing the consumer of the data to specify the data they need, as opposed to traditional REST services which serve up a fixed set of data, irrespective of the consumer’s needs.
So what does Relay do? Relay is a framework that connects React Components to GraphQL services through a container which implements Actions, a Dispatcher, and a Store. The developer need not code the Actions, Dispatcher or Store, and instead may trigger the actions and access the results through the Relay API. To configure the container, the developer must provide GraphQL query and mutation fragments to describe the data’s graph structure to the container, but otherwise Relay takes care of all of the details of managing the data.
Relay is really a framework (such as Angular), not a library. It is not implementation agnostic–it requires the UI components to be implemented with React, and the data services to be provided by GraphQL. Once the configuration of both the GraphQL server and the React components is in place, Relay takes over and performs all of the needed operations. Therefore, the key to using Relay is to master the configuration process.
Additionally, unlike frameworks such as Angular–which makes specific requirements of the client only–Relay also requires the GraphQL server interface, which provides the data query and mutation operations for the Relay containers. Relay doesn't care how the data is stored as long as the data is provided through a specific GraphQL interface.
Relay therefore requires both the back-end and front-end development teams to understand how it works, and how each of their parts need to be coded and configured.
The goal of this post is to examine Relay from the viewpoint of React. GraphQL servers can be coded and configured with any number of languages and deployed on many kinds of platforms. For GraphQL implementations in Node.js, a package named graphql-relay can be used to simplify the coding and configuration requirements for the GraphQL server. On the React side, another package named relay-react will be used to configure the Relay Containers and Routes, as well as fire off the actions for mutating the data and so forth.
Getting started with Relay is difficult. Because the technology is so new, and there are lots of competitors, there are limited resources on how to use Relay. Where there are resources, the examples are limited, and the developer is ultimately forced to read through blog posts, GitHub issues, and formal specifications in order to create a simple CRUD application. Add to that a fairly complex development environment, and the need to have a properly built GraphQL server, and the task can be quite daunting especially for new JavaScript/front-end developers.
To get started, clone the following GitHub repository to your computer and open the folder for blog-post-5+6. This folder contains a complete GraphQL/React/Relay application. To get the application up and running, open a terminal, change to the blog-post-5+6 folder, and run the following Gulp commands.
$ npm i
$ npm i -g gulp eslint eslint-config-airbnb eslint-plugin-react@^4.3.0 webpack babel-cli babel-eslint eslint-plugin-jsx-a11y@^0.6.2
$ gulp
$ npm run update-schema
$ gulp
$ gulp server
Open Microsoft Edge, then navigate to the following URL: http://localhost:3000.
A list of widgets, styled with Bootstrap 4, should appear and look similar to this:
The basic development structure of the project is the typical folder organization where the source code files are edited in the src
folder, and then copied to the distribution folder, dist
, from which the application is executed. The copying process is accomplished via Gulp through a combination of simply copying files, a task for processing SASS files, and WebPack processing for JavaScript. The WebPack processing mechanism uses the Babel transpiler to convert RelayQL, JSX and ES2015 code into ES5.1 compliant JavaScript for execution in any browser. ES2015 and JSX transpilation were covered in earlier posts, but the transpilation of RelayQL is a new topic.
GraphQL servers have the ability to produce a schema through the use of introspection. The schema is a JSON file of all of the types used by that particular GraphQL server. It includes both custom and built-in types. The Babel-Relay plugin uses this schema to validate the GraphQL fragments coded with RelayQL. The fragments are coded using ES2015 string templates, and will be converted to JavaScript once they are validated against the schema. This validation can be helpful in preventing GraphQL errors before they occur.
The easiest way to configure the Babel-Relay Plugin, as well as generate the schema, is to use the examples from the Relay website or one of the Relay Starter Kit projects. These are the files the Github repository for this blog post uses, and follow the pattern on the Relay website.
From the Relay Starter kits there are two files which are needed: build/babelRelayPlugin.js and scripts/updateSchema.js. The updateSchema.js file will be used to produce the schema, while the babelRelayPlugin.js will use the schema file to validate the GraphQL fragments as well as transform the RelayQL code.
Continue reading %Getting Started with React, GraphQL and Relay (Part 1 of 2)%