• This repository has been archived on 09/Nov/2017
  • Stars
    star
    329
  • Rank 128,030 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Deprecated in favor of https://github.com/airbnb/hypernova

Unmaintained/Deprecated

Hi everyone! Airbnb was using this module for their server-rendering and client bootstrapping but have since moved to and open sourced Hypernova which is a service that server renders your JS views but also includes some browser JS which does the server to client bootstrapping.

So this package/repo is now unmaintained and deprecated. I encourage you to check out Hypernova since it has very similar features.

--

Iso

Gitter

A helper class that allows you to hand off data from server to client.

Iso is a class. You instantiate it, add your markup, add some data to go with it, and render it. On the clientside Iso picks up what you sent down and gives it back to you so you can bring your content to life.

API

constructor(name = '', renderer = defaultRenderer)

The constructor takes in a name which is then used to build up a unique key for every added html, and a renderer which is used to determine how the data is prestented to the client. By default the renderer renders the markup into a div and the data into a script tag.

Iso#add(html: string, data: ?object): this

You provide the markup to add and some data you wish to pass down, and iso will save it internally.

Iso#render(): string

Once you're ready to collect your html you call render and a string will be returned to you.

Iso.bootstrap(onNode: function, selector: function)

onNode is a function that is called with the data, and a reference to the container node on the DOM. The selector is a function that you can configure to find the state and nodes on the DOM and return them.

The returned payload from selector should be an Object which contains the state and node pair for each unique key.

{
  "foobar": {
    state: { name: "foo" },
    node: DOMNode,
  },
}

Usage

Sample:

// server.js
const iso = new Iso()

request.get('/', function (req, res) {
  iso.add('<div>Hello, World!</div>', { someSampleData: 'Hello, World!' })
  res.render(iso.render())
})

// client.js
Iso.bootstrap(function (state, node) {
  // Now I do something with this data, perhaps run it through some library and then append
  // the result to node?
})

License

MIT

More Repositories

1

alt

Isomorphic flux implementation
JavaScript
3,448
star
2

alt-devtool

JavaScript
180
star
3

alt-tutorial

A simple flux tutorial built with alt and react
JavaScript
161
star
4

lz

an old science experiment
JavaScript
94
star
5

mango.vim

A color scheme for vim
Vim Script
87
star
6

lotus.css

A minimalist's typography focused and responsive framework for the web
CSS
71
star
7

pokemagic

JavaScript
62
star
8

microflux

A really small stateless flux backed by Flux dispatcher. Inspired by Alt + Nuclear
JavaScript
52
star
9

get-parameter-names

Retrieves the argument names of a function
JavaScript
46
star
10

isomorphic-react-examples

Many examples of rendering React server-side
JavaScript
42
star
11

alt-search-docs

An app built with React and Flux for searching alt's documentation
JavaScript
19
star
12

transmitter

A tiny pub sub library that just subscribes and publishes
JavaScript
15
star
13

akira

Putting the fun in functional since 2012
JavaScript
15
star
14

flux-form

Manage your forms with flux, any flux
JavaScript
14
star
15

node-typedjs

node module for typedjs
JavaScript
13
star
16

fixmyjs.com

The website that fixes your JavaScript
JavaScript
12
star
17

di

JavaScript dependency injection
JavaScript
11
star
18

LSDJ-Patch-Book

The LSDJ Patch Book is a web application which stores LSDJ instrument patches
PHP
11
star
19

gister

node gist api -- edit, create, and retrieve gists
JavaScript
10
star
20

Snake

A JavaScript DBAL for WebSQL
JavaScript
9
star
21

git-stats

nodejs git stats
JavaScript
8
star
22

es-symbol

A spec-compliant as much as it could be, small, and tested ES6 Symbol implementation.
JavaScript
6
star
23

koala-t

Use npm scripts rather than this.
CoffeeScript
5
star
24

create-actions

An FSA compliant action creator for automatically generating a bunch of actions
JavaScript
4
star
25

deux

JavaScript
4
star
26

react-ssr-benchmarks

Benchmarks comparing React's server rendering for versions 12--15
JavaScript
4
star
27

dotfiles

Personal Dotfiles
Vim Script
4
star
28

chipotle-meal-generator

Randomly generate any combination of chipotle deliciousness
JavaScript
4
star
29

forge

A cli tool written in nodejs useful for building projects
JavaScript
4
star
30

node-calc

evil node calc
JavaScript
4
star
31

fn-extractor

Extracts functions from JavaScript code
CoffeeScript
4
star
32

instabio

generate random instagram bios
JavaScript
4
star
33

LSDJ2XML

Converts an LSDJ Game Boy SAV file's instruments into XML
C
4
star
34

fu

tiny and functional and fast
JavaScript
4
star
35

webOS-Custom-Swipe-Menu

[Mojo] A custom menu shows when swiping an item off it's list. Replaces the default "Delete" options with anything the developer chooses.
JavaScript
4
star
36

node-jstransform

Transforms ES6 into ES5 on node using jstransform
JavaScript
3
star
37

siesta

Create RESTful services somewhat easily with an incomplete library
JavaScript
3
star
38

nms

Node Modules sync to all your computers via GitHub
JavaScript
3
star
39

spaceship

Algorithm for generating spaceships
JavaScript
3
star
40

react-flux-workshop

Another flux tutorial.
JavaScript
3
star
41

sixit

Turn your vanilla Java Script into a Venti Iced Skinny Hazelnut Macchiato, Sugar-Free Syrup, Extra Shot, Light Ice, No Whip Script
JavaScript
3
star
42

Arcane

A just for fun information mangler
JavaScript
2
star
43

markblock

JavaScript
2
star
44

akira.vim

ViM extensions for akira lang
Vim Script
2
star
45

dune

Little sandbox for Node.js
JavaScript
2
star
46

Euler

Various solutions to problems found in projecteuler.net -- implemented in multiple languages
Python
2
star
47

mangojs

JavaScript syntax highlighting for fun - based on mango.vim
JavaScript
2
star
48

giphy-browser

Essentially a small Giphy browser
TypeScript
1
star
49

jshintify

Stream module for linting JavaScript programs
JavaScript
1
star
50

jstransform-es6-class-visitor

all about the class / no munging
JavaScript
1
star
51

rework-comments

Remove comments from files using rework without minifying
JavaScript
1
star
52

maildate

Mail-like date formatting
JavaScript
1
star
53

space

a space game [TBD]
CoffeeScript
1
star
54

balloon-go-boom-sdl

SDL version of Balloon Go Boom - written just as a test
C++
1
star
55

sixpack

package es6 programs for use within other programs
JavaScript
1
star
56

get-scope

get global and function scope in javascript using the JS AST
JavaScript
1
star
57

Balloon-Go-Boom

A fun balloon popping game
JavaScript
1
star
58

resolver

Just testing
JavaScript
1
star
59

mustard

Templates for your CLI
CoffeeScript
1
star
60

mangleify

Stream module for mangling JavaScript files
JavaScript
1
star
61

testla

Lightweight and opinionated testing framework for node.js and browsers
JavaScript
1
star
62

goatslacker.github.io

HTML
1
star
63

waffles

(#)
C
1
star
64

gulp-vm

Run scripts in gulp
JavaScript
1
star
65

tg

Dynamic type checking function for JavaScript
JavaScript
1
star
66

Yammerhead

Open-source Yammer client for Palm WebOS (Mojo)
JavaScript
1
star
67

CEJ25

Mirror of CEJ25 a chess engine written in Swift
Swift
1
star