1module Generate.JavaScript.Helpers where
3import Language.ECMAScript3.Syntax
11varDecl :: String -> Expression () -> VarDecl ()
13 VarDecl () (var x) (Just expr)
16make :: [String] -> Expression ()
18 obj (moduleName ++ ["make"]) <| ref localRuntime
21useLazy :: [String] -> String -> Expression ()
22useLazy moduleName functionName =
23 DotRef () (make moduleName) (var functionName)
33ref :: String -> Expression ()
38prop :: String -> Prop ()
43obj :: [String] -> Expression ()
47 foldl (DotRef ()) (ref x) (map var xs)
50 error "dotSep must be called on a non-empty list of variables"
55(<|) :: Expression () -> Expression () -> Expression ()
60function :: [String] -> [Statement ()] -> Expression ()
62 FuncExpr () Nothing (map var args) stmts
65call :: Expression () -> [Expression ()] -> Expression ()
72equal :: Expression () -> Expression () -> Expression ()
74 InfixExpr () OpStrictEq a b
77instanceof :: String -> Expression () -> Expression ()
79 InfixExpr () OpLAnd (typeof "object" x) (InfixExpr () OpInstanceof x (ref tipe))
82typeof :: String -> Expression () -> Expression ()
84 equal (PrefixExpr () PrefixTypeof x) (StringLit () tipe)
87member :: String -> Expression () -> Expression ()
89 InfixExpr () OpIn (StringLit () field) x
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list