lib/reactive-ruby/isomorphic_helpers.rb in hyper-react-0.10.0 vs lib/reactive-ruby/isomorphic_helpers.rb in hyper-react-0.11.0
- old
+ new
@@ -51,11 +51,11 @@
def self.on_opal_client?
false
end
else
def self.on_opal_server?
- `typeof window.document === 'undefined'`
+ `typeof Opal.global.document === 'undefined'`
end
def self.on_opal_client?
!on_opal_server?
end
@@ -141,10 +141,10 @@
end
def send_to_server(*args)
if IsomorphicHelpers.on_opal_server?
args_as_json = args.to_json
- @result = [JSON.parse(`window.ServerSideIsomorphicMethods[#{@name}](#{args_as_json})`)]
+ @result = [JSON.parse(`Opal.global.ServerSideIsomorphicMethods[#{@name}](#{args_as_json})`)]
end
end
def when_on_server(&block)
@result = [block.call.to_json] unless IsomorphicHelpers.on_opal_client? || IsomorphicHelpers.on_opal_server?