class LucidSimpleOperation extend Preact::PropDeclarationMixin extend Isomorfeus::Operation::GenericClassApi class << self if RUBY_ENGINE == 'opal' def op; end else def inherited(base) Isomorfeus.add_valid_operation_class(base) end def op(&block) @op = block end end end attr_reader :props def initialize(**props_hash) @props = self.class.validated_props(props_hash) end def promise_run original_promise = Promise.new operation = self promise = original_promise.then do |_| operation.instance_exec(&operation.class.instance_variable_get(:@op)) end original_promise.resolve promise end def current_user Isomorfeus.current_user end def pub_sub_client Isomorfeus.pub_sub_client end end