Sha256: c7fba2dbbb4ef68482ef3489d9413ed81d60003def1f68ed76dc51790b3a44eb

Contents?: true

Size: 734 Bytes

Versions: 6

Compression:

Stored size: 734 Bytes

Contents

module Hyperstack
  module Internal
    module Router
      class IsomorphicMethods
        include Hyperstack::Component::IsomorphicHelpers

        def self.ctx
          @ctx ||= `{}`
        end

        prerender_footer do |_controller|
          next unless on_opal_server?
          ctx_as_hash = Hash.new(@ctx)
          @ctx = `{}`
          raise "Hyperstack::Internal::Component::Redirect #{ctx_as_hash[:url]} status: #{ctx_as_hash[:status]}" if ctx_as_hash[:url]
        end

        isomorphic_method(:request_fullpath) do |f|
          f.when_on_client { `window.location.pathname` }
          f.send_to_server
          f.when_on_server { f.context.controller.request.fullpath }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyper-router-1.0.alpha1.8 lib/hyperstack/internal/router/isomorphic_methods.rb
hyper-router-1.0.alpha1.7 lib/hyperstack/internal/router/isomorphic_methods.rb
hyper-router-1.0.alpha1.6 lib/hyperstack/internal/router/isomorphic_methods.rb
hyper-router-1.0.alpha1.5 lib/hyperstack/internal/router/isomorphic_methods.rb
hyper-router-1.0.alpha1.4 lib/hyperstack/internal/router/isomorphic_methods.rb
hyper-router-1.0.alpha1.3 lib/hyperstack/internal/router/isomorphic_methods.rb