forked from davglass/nodejs-yui3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
io.js
executable file
·80 lines (66 loc) · 1.88 KB
/
io.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env node
var sys = require('sys');
var YUI = require("yui3").YUI;
YUI({
filter: 'debug',
debug: true
}).use('json', 'io', function(Y) {
var url = 'http:/'+'/yuilibrary.com/gallery/api/user/davglass';
var url2 = 'http:/'+'/localhost/~davglass/node-post/';
var url3 = 'http:/'+'/localhost:8500/';
var url4 = 'https:/'+'/graph.facebook.com:443/davglass';
Y.io(url, {
on: {
start: function() {
Y.log('Start IO #1', 'info', 'io1');
},
success: function(id, o) {
//Y.log(o.responseText);
Y.log(sys.inspect(Y.JSON.parse(o.responseText).userinfo), 'info', 'io1');
}
}
});
Y.io(url2, {
method: 'POST',
headers: {
foo: 'bar'
},
//data: 'test=post&this=data&testing=three',
data: {
test: 'post',
'this': 'data',
'testing': 'three'
},
on: {
start: function() {
Y.log('Start IO #2', 'info', 'io2');
},
success: function(id, o) {
Y.log(sys.inspect(Y.JSON.parse(o.responseText)), 'info', 'io2');
},
failure: function(id, o) {
Y.log('IO #2 FAILED', 'error', 'io2');
}
}
});
Y.io(url3, {
on: {
start: function() {
Y.log('Start IO #3', 'info', 'io3');
},
failure: function(id, o) {
Y.log('IO FAILED', 'error', 'io3');
}
}
});
Y.io(url4, {
on: {
start: function() {
Y.log('Start IO #4', 'info', 'io4');
},
success: function(id, o) {
Y.log(sys.inspect(Y.JSON.parse(o.responseText)), 'info', 'io4');
}
}
});
});