-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollabActivity.js
43 lines (34 loc) · 1.06 KB
/
collabActivity.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
navigator.mozSetMessageHandler('activity', function(activityRequest) {
var name = activityRequest.source.name;
var data = activityRequest.source.data;
var sdcard = navigator.getDeviceStorage('sdcard');
var request = sdcard.addNamed(data.blob, 'shared_docs/sdcard/' + data.filename);
request.addEventListener('success', function() {
alert('success')
});
request.addEventListener('error', function() {
alert(this.error);
});
//alert('done');
if(0) {
var deviceStorage = data.path.split('/')[1];
var path = data.path.split('/').slice(2).join('/');
var storage = navigator.getDeviceStorage(deviceStorage);
var req = storage.get(path);
req.addEventListener('success', function() {
var file = this.result;
var req = storage.delete(path);
req.addEventListener('success', function() {
storeFile(data.path, file, function() {
window.location = 'index.html';
});
});
req.addEventListener('error', function() {
alert(this.error);
});
});
req.addEventListener('error', function() {
alert(this.error);
});
}
});