Class: Sentiero::Web::ShareableReplay
- Inherits:
-
Object
- Object
- Sentiero::Web::ShareableReplay
- Includes:
- Escaping
- Defined in:
- lib/sentiero/web/shareable_replay.rb
Overview
Builds a single self-contained HTML document for a whole session, inlining the rrweb-player JS/CSS and the session's events so it replays offline with no server. #html returns the document, or nil when there's nothing to replay.
Events are inlined as a in the data cannot break out of the script context.
Constant Summary
Constants included from Escaping
Escaping::HTML_UNSAFE_IN_SCRIPT, Escaping::HTML_UNSAFE_IN_SCRIPT_PATTERN
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(store, session_id) ⇒ ShareableReplay
constructor
A new instance of ShareableReplay.
Methods included from Escaping
#escape_html, #escape_js_string, #escape_json
Constructor Details
#initialize(store, session_id) ⇒ ShareableReplay
Returns a new instance of ShareableReplay.
18 19 20 21 |
# File 'lib/sentiero/web/shareable_replay.rb', line 18 def initialize(store, session_id) @store = store @session_id = session_id end |
Instance Method Details
#html ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sentiero/web/shareable_replay.rb', line 23 def html session = @store.get_session(@session_id) return nil if session.nil? windows = session[:windows] || [] return nil if windows.empty? events = collect_events(windows) return nil if events.empty? build_html(events) end |