我在诺琴蒂大学做了一个简单的网络浏览器。 万维网浏览器电灯将显示与
网站服务器
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
我撰写了一个简单的“奥约”方案,当你发布《纽伦》时,它会提供网络服务,并在警示箱中显示结果。
enyo.kind({
name: "MyApps.MainApp",
kind: enyo.VFlexBox,
// comment code to load in data gfrom service
components: [
{name: "getName", kind: "WebService",
onSuccess: "gotName",
onFailure: "gotNameFailure",
url: "http://localhost:8888/"
},
{kind: "PageHeader", content: "Enyo FeedReader"},
{name:"curValue", content:("Sample Text")},
{kind: "Button", caption: "Action", onclick: "btnClick"} ],
// functions go here
create: function()
{
// call the default creat then do our stuff
this.inherited(arguments);
this.$.getName.call();
},
// Show output of server,
gotName: function(inSender, inResponse) {
this.$.button.setCaption("Success");
alert(inResponse );
},
// go here if it cold not connect to server
gotNameFailure: function(inSender, inResponse) {
this.$.button.setCaption("Failure"); },
// call the server
btnClick: function() {
this.$.getName.call(); }
});
Ted