lib/browser/history.rb in isomorfeus-preact-23.8.0.rc3 vs lib/browser/history.rb in isomorfeus-preact-23.9.0.rc1
- old
+ new
@@ -1,19 +1,16 @@
# backtick_javascript: true
module Browser
class History
if RUBY_ENGINE == 'opal'
- include Native::Wrapper
+ include DelegateNative
- alias_native :back
- alias_native :forward
- alias_native :go
+ def size
+ length
+ end
- native_reader :length
- alias :size :length
-
def push_state(state, title = '', url = `null`)
`#@native.pushState(Object.fromEntries(#{state}), #{title}, #{url})`
end
def replace_state(state, title = '', url = `null`)
@@ -27,11 +24,11 @@
def scroll_restoration=(s)
`#@native.scrollRestoration = #{s}`
end
def state
- `Opal.hash(#@native.state)`
+ `(#@native.state) ? Opal.hash(#@native.state) : nil`
end
else
def back; end
def forward; end
def go(_); end
@@ -45,10 +42,10 @@
def replace_state(state, title = '', url = nil); end
def scroll_restoration; end
def scroll_restoration=(s); end
def state
- {}
+ nil
end
end
end
end