Currently it for clent-side apps only. Not for universall (isomorphic) apps. Will add it soon
I'm using the promise middleware to dispatch actions like this:
'use strict'; | |
/*****************NATIVE forEACH*********************/ | |
Array.prototype.myEach = function(callback) { | |
for (var i = 0; i < this.length; i++) | |
callback(this[i], i, this); | |
}; | |
//tests |
/* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
/* CSS */ | |
Currently it for clent-side apps only. Not for universall (isomorphic) apps. Will add it soon
I'm using the promise middleware to dispatch actions like this:
// credit goes to this stack overflow post - http://stackoverflow.com/questions/20646836/is-there-any-way-to-import-a-json-filecontains-100-documents-in-elasticsearch | |
var elasticsearch = require('elasticsearch'), | |
fs = require('fs'), | |
pubs = JSON.parse(fs.readFileSync(__dirname + '/pubs.json')), // name of my first file to parse | |
forms = JSON.parse(fs.readFileSync(__dirname + '/forms.json')); // and the second set | |
var client = new elasticsearch.Client({ // default is fine for me, change as you see fit | |
host: 'localhost:9200', | |
log: 'trace' | |
}); |
export class Dispatcher { | |
constructor () { | |
this.events = {}; | |
} | |
addListener (event, callback) { | |
// Check if the callback is not a function | |
if (typeof callback !== 'function') { | |
console.error(`The listener callback must be a function, the given type is ${typeof callback}`); | |
return false; |
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
package main | |
import ( | |
"fmt" | |
) | |
// Use map[string]interface{} to pair functions to name | |
// Could maybe use anonymous functions instead. Might be clean | |
// in certain cases | |
var funcMap = map[string]interface{}{ |
import express from 'express'; | |
import React from 'react'; | |
import ReactDOMServer from 'react-dom/server'; | |
import App from './components/App'; | |
import {flushServerSideRequires} from 'react-loadable'; | |
let app = express(); | |
let webpackStats = require('./output-webpack-stats.json'); |
⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates
What this will cover
www.website.com
to website.com
index.html
)