forked from goatslacker/alt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAltIso.js
More file actions
28 lines (25 loc) · 679 Bytes
/
Copy pathAltIso.js
File metadata and controls
28 lines (25 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Iso from 'iso'
import * as Render from './Render'
export default {
define: Render.withData,
render(alt, Component, props) {
if (typeof window === 'undefined') {
return Render.toString(alt, Component, props).then((obj) => {
return {
html: Iso.render(obj.html, obj.state, { iso: 1 }),
}
}).catch((err) => {
// return the empty markup in html when there's an error
return {
err,
html: Iso.render(),
}
})
}
Iso.bootstrap((state, meta, node) => {
alt.bootstrap(state)
Render.toDOM(Component, props, node, meta.iso)
})
return Promise.resolve()
},
}