Skip to content

Commit

Permalink
Fix server rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed May 18, 2015
1 parent 6b44a27 commit 97526af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/00 Chessboard/Tutorial App/Board.js
Expand Up @@ -44,7 +44,7 @@ export default class Board {
<div style={{
width: '100%',
height: '100%',
display: window.safari ? '-webkit-flex' : 'flex', // Don't do that in a real app
display: typeof window !== 'undefined' && window.safari ? '-webkit-flex' : 'flex', // Don't do that in a real app
flexWrap: 'wrap',
WebkitFlexWrap: 'wrap'
}}>
Expand Down
10 changes: 5 additions & 5 deletions src/backends/HTML5.js
Expand Up @@ -95,13 +95,13 @@ class HTML5Backend {
}

setup() {
invariant(!this.constructor.isSetUp, 'Cannot have two HTML5 backends at the same time.');
this.constructor.isSetUp = true;

if (typeof window === 'undefined') {
return;
}

invariant(!this.constructor.isSetUp, 'Cannot have two HTML5 backends at the same time.');
this.constructor.isSetUp = true;

window.addEventListener('dragstart', this.handleTopDragStart);
window.addEventListener('dragstart', this.handleTopDragStartCapture, true);
window.addEventListener('dragend', this.handleTopDragEndCapture, true);
Expand All @@ -115,12 +115,12 @@ class HTML5Backend {
}

teardown() {
this.constructor.isSetUp = false;

if (typeof window === 'undefined') {
return;
}

this.constructor.isSetUp = false;

window.removeEventListener('dragstart', this.handleTopDragStart);
window.removeEventListener('dragstart', this.handleTopDragStartCapture, true);
window.removeEventListener('dragend', this.handleTopDragEndCapture, true);
Expand Down

0 comments on commit 97526af

Please sign in to comment.