2 | module Rhone.JS.Source
6 | import Rhone.JS.ElemRef
18 | interface SafeCast t => HasValue t where
19 | getValue : t -> JSIO String
22 | HasValue HTMLButtonElement where
26 | HasValue HTMLDataElement where
30 | HasValue HTMLInputElement where
34 | HasValue HTMLOptionElement where
38 | HasValue HTMLOutputElement where
42 | HasValue HTMLParamElement where
46 | HasValue HTMLSelectElement where
50 | HasValue HTMLTextAreaElement where
54 | HasValue RadioNodeList where
58 | value : HasValue t => MSF JSIO (ElemRef t) String
59 | value = arrM $
\r => getElementByRef r >>= getValue
62 | valueOf : HasValue t => ElemRef t -> MSF JSIO i String
63 | valueOf r = const r >>> value
66 | meterValue : MSF JSIO (ElemRef HTMLMeterElement) Double
67 | meterValue = arrM $
\r => getElementByRef r >>= to value
70 | meterValueOf : ElemRef HTMLMeterElement -> MSF JSIO i Double
71 | meterValueOf r = const r >>> meterValue
74 | progressValue : MSF JSIO (ElemRef HTMLProgressElement) Double
75 | progressValue = arrM $
\r => getElementByRef r >>= to value
78 | progressValueOf : ElemRef HTMLProgressElement -> MSF JSIO i Double
79 | progressValueOf r = const r >>> progressValue
86 | getChecked : HTMLInputElement -> JSIO Bool
87 | getChecked el = get el checked
90 | checked : MSF JSIO (ElemRef HTMLInputElement) Bool
91 | checked = arrM getElementByRef >>! getChecked
94 | checkedAt : ElemRef HTMLInputElement -> MSF JSIO i Bool
95 | checkedAt r = const r >>> checked
102 | windowLocation : MSF JSIO i Location
103 | windowLocation = constM $
window >>= location
106 | windowHash : MSF JSIO i String
107 | windowHash = windowLocation >>! to Location.hash