Skip to content
Newer
Older
100644 58 lines (39 sloc) 925 Bytes
54f464b @tj fix docs
tj authored
1 # Dropload
c91c80d @tj Initial commit
tj authored
2
54f464b @tj fix docs
tj authored
3 Drag and drop upload component.
c91c80d @tj Initial commit
tj authored
4
5 ## Installation
6
718c9d3 @javve Fix typo: upload -> dropload
javve authored
7 $ component install component/dropload
c91c80d @tj Initial commit
tj authored
8
9 ## Events
10
11 - `upload` (upload) a file was dropped
e63c7c6 @tj add url / text / html support
tj authored
12 - `text` (string) string representation
13 - `url` (string) url representation
14 - `html` (string) html representation
93535a1 @tj add "drop" (e) event
tj authored
15 - `drop` (event) a drop was performed
c91c80d @tj Initial commit
tj authored
16
17 ## Example
18
19 ```js
20 var Dropload = require('dropload');
21 var drop = Dropload(document.getElementById('drop'));
22
23 drop.on('error', function(err){
24 console.error(err.message);
25 });
26
27 drop.on('upload', function(upload){
28 console.log('uploading %s', upload.file.name);
29 upload.to('/upload');
30 });
e63c7c6 @tj add url / text / html support
tj authored
31
32 drop.on('text', function(str){
33 console.log('text "%s"', str);
34 });
35
36 drop.on('url', function(str){
37 console.log('url "%s"', str);
38 });
39
40 drop.on('html', function(str){
41 console.log('html "%s"', str);
42 });
c91c80d @tj Initial commit
tj authored
43 ```
44
45 ## Running example
46
47 Run the Express test server:
48
49 ```
50 $ npm install
51 $ make test
52 ```
53
54 # License
55
56 MIT
57
Something went wrong with that request. Please try again.