You can search for identifiers within the package.
in-package search v0.2.0
Source file hooks.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117open!Coreopen!Js_of_ocamlmoduletypeS=Hooks_intf.Sletcancel_animation_frameid=Dom_html.window##cancelAnimationFrameidletrequest_animation_framef=Dom_html.window##requestAnimationFrame(Js.wrap_callbackf);;moduleExtra=structtypet=|T:{type_id:'aType_equal.Id.t;value:'a}->tletsexp_of_t(T{type_id;value})=Type_equal.Id.to_sexptype_idvalueendtypet=|T:{input:'input;input_id:'inputType_equal.Id.t;combine_inputs:'input->'input->'input;init:'input->Dom_html.elementJs.t->'input*Dom_html.animation_frame_request_id*'state;update:'input->'input*Dom_html.animation_frame_request_id*'state->Dom_html.elementJs.t->'input*Dom_html.animation_frame_request_id*'state;destroy:'input*Dom_html.animation_frame_request_id*'state->Dom_html.elementJs.t->unit;id:('input*Dom_html.animation_frame_request_id*'state)Core.Type_equal.Id.t}->tletgeneric_hook=lazyJs.Unsafe.(getglobal(Js.string"GenericHook"))letmake_hook~combine_inputs~init~extra:(input,input_id)~update~destroy~id=T{init;combine_inputs;input;input_id;update;destroy;id};;letpack(T{init;input;input_id;update;destroy;id;_})=letwrapa=a|>Js.wrap_callback|>Js.Unsafe.injectinletinit=wrap(initinput)inletupdate=wrap(updateinput)inletdestroy=wrapdestroyinletgeneric_hook=Lazy.forcegeneric_hookinletextra=Extra.T{type_id=input_id;value=input}inJs.Unsafe.fun_callgeneric_hook[|init;update;destroy;id|>Js.Unsafe.inject;extra|>Js.Unsafe.inject|];;letcombine(Tleft)(Tright)=matchType_equal.Id.same_witnessleft.input_idright.input_idwith|None->eprint_s[%message"hooks do not have the same type, so they cannot be combined; taking the second \
of the two"];Tright|SomeT->T{rightwithinput=right.combine_inputsleft.inputright.input};;moduleMake(S:S)=structletinput_and_state_id=Type_equal.Id.create~name:""(fun(input,_animation_id,state)->[%sexp_of:S.Input.t*opaque](input,state));;letinput_id=Type_equal.Id.create~name:""S.Input.sexp_of_tletinitinputelement=letstate=S.initinputelementinletanimation_id=request_animation_frame(fun_->S.on_mountinputstateelement)ininput,animation_id,state;;letupdateinput(old_input,animation_id,state)element=S.update~old_input~new_input:inputstateelement;input,animation_id,state;;letdestroy(old_input,animation_id,state)element=cancel_animation_frameanimation_id;S.destroyold_inputstateelement;;letcreateinput=make_hook~extra:(input,input_id)~combine_inputs:S.Input.combine~id:input_and_state_id~init~update~destroy;;moduleFor_testing=structlettype_id=input_idendendmoduleFor_testing=structmoduleExtra=Extraend