| Maintainer | ??? |
|---|---|
| Safe Haskell | None |
Language.Sunroof.JS.Browser
Description
A reflection of the standard browser Javascript API.
- alert :: JSString -> JS t ()
- confirm :: JSString -> JS t JSBool
- prompt :: JSString -> JSString -> JS t JSObject
- decodeURI :: JSString -> JS t JSString
- encodeURI :: JSString -> JS t JSString
- decodeURIComponent :: JSString -> JS t JSString
- encodeURIComponent :: JSString -> JS t JSString
- eval :: Sunroof a => JSString -> JS t a
- isFinite :: JSNumber -> JS t JSBool
- isNaN :: JSNumber -> JS t JSBool
- parseFloat :: JSString -> JS t JSNumber
- parseInt :: JSString -> JS t JSNumber
- window :: JSObject
- setInterval :: (() -> JSB ()) -> JSNumber -> JSObject -> JS t JSNumber
- clearInterval :: JSNumber -> JSObject -> JS t ()
- setTimeout :: (() -> JSB ()) -> JSNumber -> JSObject -> JS t JSNumber
- clearTimeout :: JSNumber -> JSObject -> JS t ()
- screen :: JSObject
- document :: JSObject
- getElementById :: JSString -> JSObject -> JS t JSObject
- getElementsByName :: JSString -> JSObject -> JS t JSObject
- getElementsByTagName :: JSString -> JSObject -> JS t JSObject
- createAttribute :: JSString -> JSObject -> JS t JSObject
- createElement :: JSString -> JSObject -> JS t JSObject
- createTextNode :: JSString -> JSObject -> JS t JSObject
- open :: JSObject -> JS t ()
- close :: JSObject -> JS t ()
- write :: JSString -> JSObject -> JS t ()
- writeln :: JSString -> JSObject -> JS t ()
- setCookie :: JSString -> JSObject -> JS t ()
- cookie :: JSSelector JSString
- referrer :: JSSelector JSString
- setTitle :: JSString -> JSObject -> JS t ()
- title :: JSSelector JSString
- url :: JSSelector JSString
- src :: JSSelector JSString
- data JSConsole
- console :: JSConsole
- log :: SunroofArgument a => a -> JSConsole -> JS t ()
- debug :: SunroofArgument a => a -> JSConsole -> JS t ()
- info :: SunroofArgument a => a -> JSConsole -> JS t ()
- warn :: SunroofArgument a => a -> JSConsole -> JS t ()
- error :: SunroofArgument a => a -> JSConsole -> JS t ()
Top level functions
prompt :: JSString -> JSString -> JS t JSObjectSource
Ask the user to give some input. May return null or a string. Don't forget to check against nullJS before casting to string.
decodeURIComponent :: JSString -> JS t JSStringSource
Decode the URI encoded string. For use with encodeURIComponent.
encodeURIComponent :: JSString -> JS t JSStringSource
Encode the string with URI encoding. This encodes a few more characters to make the string safe for direct server communication (AJAX).
eval :: Sunroof a => JSString -> JS t aSource
Evaluate the given JavaScript string if possible. Returns the result of evaluation. TODO: think about this a bit.
isFinite :: JSNumber -> JS t JSBoolSource
Check if a given number is within the valid JavaScript number range.
parseFloat :: JSString -> JS t JSNumberSource
Parse the given string to a number.
Window API
setInterval :: (() -> JSB ()) -> JSNumber -> JSObject -> JS t JSNumberSource
Calls a function at specified intervals in milliseconds. It will continue calling the function until clearInterval is called, or the window is closed. The returned number is needed for clearInterval. This is supposed to be called on the window object. See: http://www.w3schools.com/jsref/met_win_setinterval.asp
clearInterval :: JSNumber -> JSObject -> JS t ()Source
Clears a timer set with the setInterval method. This is supposed to be called on the window object. See: http://www.w3schools.com/jsref/met_win_clearinterval.asp
setTimeout :: (() -> JSB ()) -> JSNumber -> JSObject -> JS t JSNumberSource
Execute the given continutation after the given amount of milliseconds. Returns a handler for the set timer. This is supposed to be called on the window object. See: http://www.w3schools.com/jsref/met_win_settimeout.asp
clearTimeout :: JSNumber -> JSObject -> JS t ()Source
Removes the timer associated with the given handler. This is supposed to be called on the window object. See: http://www.w3schools.com/jsref/met_win_cleartimeout.asp
Screen API
Document API
Get the DOM object of the element with the given id. For use with document.
Get the DOM objects of the elements with the given name. For use with document.
Get the DOM objects of the elements with the given tag. For use with document.
Create a attribute DOM node with the given name. For use with document.
Create a element DOM node with the given tag name. For use with document.
Create a text DOM node with the given string as text. For use with document.
write :: JSString -> JSObject -> JS t ()Source
Writes something into the document. For use with document.
writeln :: JSString -> JSObject -> JS t ()Source
Write something into the document and appends a new line. For use with document.
setCookie :: JSString -> JSObject -> JS t ()Source
Sets the value of the cookie. For use with document.
cookie :: JSSelector JSStringSource
Returns the value of the cookie. For use with document.
referrer :: JSSelector JSStringSource
Returns the referrer of the document. For use with document.
setTitle :: JSString -> JSObject -> JS t ()Source
Sets the title of the document. For use with document.
title :: JSSelector JSStringSource
Returns the title of the document. For use with document.
url :: JSSelector JSStringSource
Returns the complete URL of the document. For use with document.
Image DOM
src :: JSSelector JSStringSource
Returns the src of a DOM image object.
The JavaScript Console
The type of the debugging console object. See: https://developers.google.com/chrome-developer-tools/docs/console-api, https://developer.mozilla.org/en-US/docs/DOM/console, http://msdn.microsoft.com/en-us/library/windows/apps/hh696634.aspx;
log :: SunroofArgument a => a -> JSConsole -> JS t ()Source
Log the given message.
debug :: SunroofArgument a => a -> JSConsole -> JS t ()Source
Send a debug level message to the console.
info :: SunroofArgument a => a -> JSConsole -> JS t ()Source
Send a info message to the console.
warn :: SunroofArgument a => a -> JSConsole -> JS t ()Source
Send a warning message to the console.
error :: SunroofArgument a => a -> JSConsole -> JS t ()Source
Send an error message to the console.