Skip to content

Commit 81d423e

Browse files
committed
Merge pull request #84 from digitalcuisine/happy-browserify
Remove need for global workaround and make Browserify happy
2 parents 45ca4ad + 4a13040 commit 81d423e

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

lib/react/renderer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def self.render(component, args={})
2323
def self.setup_combined_js
2424
<<-CODE
2525
var global = global || this;
26+
var self = self || this;
27+
var window = window || this;
2628
2729
var console = global.console || {};
2830
['error', 'log', 'info', 'warn'].forEach(function (fn) {
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
11
//= require_self
22
//= require_tree ./components
3-
4-
// This is because we compile this file into a JS VM
5-
// for server rendering, and some components may be
6-
// .coffee and wrapped in a func, so they need a
7-
// global to glom on to.
8-
var self, window, global = global || window || self;

test/dummy/app/assets/javascripts/components/Todo.js.jsx.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Todo = React.createClass
66

77
# Because Coffee files are in an anonymous function,
88
# expose it for server rendering tests
9-
global.Todo = Todo
9+
window.Todo = Todo

0 commit comments

Comments
 (0)