Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit 1c6ff39

Browse files
committed
Merge pull request #6 from purescript-contrib/additions
Add more web API types
2 parents bcd1ec1 + c0df026 commit 1c6ff39

File tree

7 files changed

+147
-59
lines changed

7 files changed

+147
-59
lines changed

README.md

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,97 @@
22

33
## Module DOM
44

5-
### Types
5+
#### `DOM`
66

7-
data DOM :: !
7+
``` purescript
8+
data DOM :: !
9+
```
810

9-
data Node :: *
11+
Effect type for DOM maniupulation
1012

11-
data NodeList :: *
13+
#### `Node`
14+
15+
``` purescript
16+
data Node :: *
17+
```
18+
19+
General type for DOM nodes.
20+
21+
#### `NodeList`
22+
23+
``` purescript
24+
data NodeList :: *
25+
```
26+
27+
General type for DOM node lists.
28+
29+
30+
## Module DOM.File
31+
32+
33+
Types for the [W3C File API](http://dev.w3.org/2006/webapi/FileAPI/).
34+
35+
#### `File`
36+
37+
``` purescript
38+
data File :: *
39+
```
40+
41+
A `File` object instance.
42+
43+
#### `FileList`
44+
45+
``` purescript
46+
data FileList :: *
47+
```
48+
49+
A `FileList` object instance.
50+
51+
#### `FileReader`
52+
53+
``` purescript
54+
data FileReader :: *
55+
```
56+
57+
A `FileReader` object instance.
58+
59+
#### `Blob`
60+
61+
``` purescript
62+
data Blob :: *
63+
```
64+
65+
A `Blob` object instance.
66+
67+
68+
## Module DOM.XHR
69+
70+
71+
Types for the [WHATWG XMLHttpRequest Living Standard](https://xhr.spec.whatwg.org/#interface-formdata).
72+
73+
#### `XMLHttpRequest`
74+
75+
``` purescript
76+
data XMLHttpRequest :: *
77+
```
78+
79+
An `XMLHttpRequest` object instance.
80+
81+
#### `FormData`
82+
83+
``` purescript
84+
data FormData :: *
85+
```
86+
87+
A `FormData` object instance.
88+
89+
#### `ProgressEvent`
90+
91+
``` purescript
92+
data ProgressEvent :: *
93+
```
94+
95+
A `ProgressEvent` object instance.
1296

1397

1498

bower.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "purescript-dom",
3-
"version": "0.1.0",
43
"description": "PureScript interface for the DOM.",
54
"license": "MIT"
65
}

gulpfile.js

Lines changed: 19 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,27 @@
1-
'use strict'
1+
"use strict";
22

3-
var gulp = require('gulp')
4-
, purescript = require('gulp-purescript')
5-
;
3+
var gulp = require("gulp");
4+
var plumber = require("gulp-plumber");
5+
var purescript = require("gulp-purescript");
6+
var jsvalidate = require("gulp-jsvalidate");
67

7-
var paths = {
8-
src: 'src/**/*.purs',
9-
bowerSrc: [
10-
'bower_components/purescript-*/src/**/*.purs',
11-
'bower_components/purescript-*/src/**/*.purs.hs'
12-
],
13-
dest: '',
14-
docsDest: 'README.md'
15-
};
16-
17-
var options = {};
18-
19-
var compile = function(compiler) {
20-
var psc = compiler(options);
21-
psc.on('error', function(e) {
22-
console.error(e.message);
23-
psc.end();
24-
});
25-
return gulp.src([paths.src].concat(paths.bowerSrc))
26-
.pipe(psc)
27-
.pipe(gulp.dest(paths.dest));
28-
};
29-
30-
gulp.task('make', function() {
31-
return compile(purescript.pscMake);
32-
});
33-
34-
gulp.task('browser', function() {
35-
return compile(purescript.psc);
36-
});
37-
38-
gulp.task('docs', function() {
39-
return gulp.src(paths.src)
40-
.pipe(purescript.docgen())
41-
.pipe(gulp.dest(paths.docsDest));
8+
gulp.task("make", function() {
9+
return gulp.src(["src/**/*.purs", "bower_components/purescript-*/src/**/*.purs"])
10+
.pipe(plumber())
11+
.pipe(purescript.pscMake());
4212
});
4313

44-
gulp.task('watch-browser', function() {
45-
gulp.watch(paths.src, ['browser', 'docs']);
14+
gulp.task("jsvalidate", ["make"], function () {
15+
return gulp.src("output/**/*.js")
16+
.pipe(plumber())
17+
.pipe(jsvalidate());
4618
});
4719

48-
gulp.task('watch-make', function() {
49-
gulp.watch(paths.src, ['make', 'docs']);
20+
gulp.task("docs", function () {
21+
return gulp.src("src/**/*.purs")
22+
.pipe(plumber())
23+
.pipe(purescript.pscDocs())
24+
.pipe(gulp.dest("README.md"));
5025
});
5126

52-
gulp.task('default', ['make', 'docs']);
27+
gulp.task("default", ["jsvalidate", "docs"]);

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
2-
"name": "purescript-dom",
3-
"version": "0.0.0",
4-
"description": "PureScript interface for the DOM.",
5-
"license": "MIT",
2+
"private": true,
63
"devDependencies": {
7-
"gulp": "^3.8.1",
8-
"gulp-purescript": "0.0.8"
4+
"gulp": "^3.8.11",
5+
"gulp-jsvalidate": "^1.0.1",
6+
"gulp-plumber": "^1.0.0",
7+
"gulp-purescript": "^0.1.2"
98
}
109
}

src/DOM.purs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
module DOM where
22

3-
foreign import data Node :: *
4-
5-
foreign import data NodeList :: *
3+
-- | Effect type for DOM maniupulation
4+
foreign import data DOM :: !
65

7-
foreign import data DOM :: !
6+
-- | General type for DOM documents.
7+
foreign import data Document :: *
8+
9+
-- | General type for DOM nodes.
10+
foreign import data Node :: *
11+
12+
-- | General type for DOM node lists.
13+
foreign import data NodeList :: *

src/DOM/File.purs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- | Types for the [W3C File API](http://dev.w3.org/2006/webapi/FileAPI/).
2+
module DOM.File where
3+
4+
-- | A `File` object instance.
5+
foreign import data File :: *
6+
7+
-- | A `FileList` object instance.
8+
foreign import data FileList :: *
9+
10+
-- | A `FileReader` object instance.
11+
foreign import data FileReader :: *
12+
13+
-- | A `Blob` object instance.
14+
foreign import data Blob :: *

src/DOM/XHR.purs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- | Types for the [WHATWG XMLHttpRequest Living Standard](https://xhr.spec.whatwg.org/#interface-formdata).
2+
module DOM.XHR where
3+
4+
-- | An `XMLHttpRequest` object instance.
5+
foreign import data XMLHttpRequest :: *
6+
7+
-- | A `FormData` object instance.
8+
foreign import data FormData :: *
9+
10+
-- | A `ProgressEvent` object instance.
11+
foreign import data ProgressEvent :: *

0 commit comments

Comments
 (0)