forked from davglass/nodejs-yui3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
io.js
executable file
·62 lines (49 loc) · 1.39 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
#!/usr/bin/env node
var sys = require('sys');
var YUI = require("yui3").YUI;
require("assert").equal( global.YUI, undefined, "global yui created");
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/';
Y.io(url, {
on: {
start: function() {
Y.log('Start IO', 'info', 'TEST');
},
success: function(id, o) {
//Y.log(o.responseText);
Y.log(sys.inspect(Y.JSON.parse(o.responseText).userinfo));
}
}
});
Y.io(url2, {
method: 'POST',
headers: {
foo: 'bar'
},
data: 'test=post&this=data&testing=three',
on: {
start: function() {
Y.log('Start IO', 'info', 'TEST');
},
success: function(id, o) {
//Y.log(o.responseText);
Y.log(sys.inspect(Y.JSON.parse(o.responseText)));
}
}
});
Y.io(url3, {
on: {
start: function() {
Y.log('Start IO', 'info', 'TEST');
},
failure: function(id, o) {
Y.log('IO FAILED', 'error');
}
}
});
});