Class: Dommy::ViewTransition

Inherits:
Object
  • Object
show all
Defined in:
lib/dommy/document.rb

Overview

‘ViewTransition` — return value of `document.startViewTransition()`. All three Promises (`finished` / `ready` / `updateCallbackDone`) resolve immediately since dommy has no actual paint phase.

Spec: drafts.csswg.org/css-view-transitions/

Constant Summary collapse

JS_METHOD_NAMES =

Methods routed through js_call (keep in sync with its when-arms).

%w[skipTransition].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(window) ⇒ ViewTransition

Returns a new instance of ViewTransition.



788
789
790
791
792
# File 'lib/dommy/document.rb', line 788

def initialize(window)
  @finished = PromiseValue.resolve(window, nil)
  @ready = PromiseValue.resolve(window, nil)
  @update_callback_done = PromiseValue.resolve(window, nil)
end

Instance Attribute Details

#finishedObject (readonly)

Returns the value of attribute finished.



794
795
796
# File 'lib/dommy/document.rb', line 794

def finished
  @finished
end

#readyObject (readonly)

Returns the value of attribute ready.



794
795
796
# File 'lib/dommy/document.rb', line 794

def ready
  @ready
end

Instance Method Details

#__js_call__(method, _args) ⇒ Object



825
826
827
828
829
830
# File 'lib/dommy/document.rb', line 825

def __js_call__(method, _args)
  case method
  when "skipTransition"
    skip_transition
  end
end

#__js_get__(key) ⇒ Object



808
809
810
811
812
813
814
815
816
817
# File 'lib/dommy/document.rb', line 808

def __js_get__(key)
  case key
  when "finished"
    @finished
  when "ready"
    @ready
  when "updateCallbackDone"
    @update_callback_done
  end
end

#__js_method_names__Object



821
822
823
# File 'lib/dommy/document.rb', line 821

def __js_method_names__
  JS_METHOD_NAMES
end

#skip_transitionObject Also known as: skipTransition



802
803
804
# File 'lib/dommy/document.rb', line 802

def skip_transition
  nil
end

#update_callback_doneObject Also known as: updateCallbackDone



796
797
798
# File 'lib/dommy/document.rb', line 796

def update_callback_done
  @update_callback_done
end