xamin arcross platform for mobile
- 格式:pdf
- 大小:461.60 KB
- 文档页数:27


附录1The application of AjaxSpend a few minutes using your application you selected(browser except),write it down to what user interaction,and then immediately back.For the sake of brevity,I give an example of electronic form,however,points involved here is general enough for various cases,the text editor.Well,we started.First in the spreadsheet to input some equalities,pay attention to,can interact in several ways:edit data,browsing the data using the keyboard and mouse,also can use the mouse to drag to re organize the data.I do these operations,the program gave me feedback.When moving the mouse,the cursor changes shape;when the mouse stops above,button bright;selected text can change color.When a window or dialog box is selected,and usually isnot the same,etc..These are the so-called"rich"interaction.Of course,there are still some room for improvement,but this is a good start.OK,a spreadsheet is a rich client program?Absolutely not.In a spreadsheet or similar desktop applications,business logic and data model is run in a closed environment.In this environment,they clearly understand each other,and can visit each other,and the environment outside of things,is unknown to them.What is the client?It is a separate process of mutual communication program,which is usually run on the server.In general,the server is always bigger than the client,ability,disposition is better,because the server is usually stored multitudeinformation.The client program enables the end users can view and modify the information,when multiple clients connected to the same server,can shareinformation between them.Shows a simple client/server architecture.In the n layer architecture in the modern,the server often and further the back-end server(such as a database)communication,so called"middleware"layeralso plays a role of client and server.End of our Ajax application in the chain,it is only as the client,therefore,for the convenience of discussion,we can put the whole n system as a labeled as"black box server".Spreadsheet applications I only need to manage its own saved a small amount of data in memory or in the local file system.If the design of well structure,couplingform data and it can be very loose,but I can't pass a network to split or sharethem through network.In this sense,the application of electronic form is not a client.The corresponding Web browser is a typical client,which communicate with the Web server,the request page.The browser has abundant functions,used tomanage user browsing behavior,the common function of the back button,the history list and tabbed browsing multiple documents etc..But when we put the site specific Web pages as an application,these general browsing function actuallyand application is,at best,such as spreadsheets and Windows began the relationship between button or the window list.We consider the application of modern Web.For the sake of simplicity,we chose" earth people know"online bookstore.Open the Amazon site in the browser,because before I visited,it will show me a friendlygreeting,somerecommended bibliography,and my purchase history information.Click on any one of the recommended bibliography,will go to another page(at this time,the page to refresh,within a few seconds I what also don't see).The new page is the information relevant to the book review:other books,second-hand books,offer the same author,and other books I read.In short,appears to be very rich,high degree of associated information in front of me.But for me,interactive way is to click on the hyperlink,and then fill in some forms.Suppose I at the keyboard accidentally fell asleep,wake up second days,if not refresh the page,I don't know"Harry Porter"series of books have been published,nor will my list from one page to another page,if I want to see morethings too,because I cannot change the local content area page size.I seem to be in the criticism of the Amazon interface,but it is not the case,I justtook it as an example.In fact,in the traditional Web development of the shackles,they have done very well.But compared to the spreadsheet,and the interaction model is undoubtedly too limited.Why Web is the application of modern still have so many limitations?The currentsituation has some reasonable technical reasons,we have to consider now.The blueprint for the Internet is all the computer in the world are connected,forming a huge computing resources.If the local data and remote invocationequated,then both the analysis of protein components or crack signals from outer space,users need not consider the physical location of the machines,the rest of the computation only pleasure.But unfortunately,the local call and remote invocation is something totally different.Under the current level of technology,the network communication is still a costly things(that is to say,is usually very slow,but unreliable).In the absence of a network called the situation,method and function of different data and theiroperations are located in the same local memory,to transfer data and return the results obtained are very direct.In a remote call,communication in the network at both ends of the two sides to send and receive data requires a lot of computation at the pared with the data back and forth on the line,these calculations require more time consuming.The transmission of a binary data,to go through many steps of coding and decoding,error checking,failure,packet retransmission split andreorganization,data into 0 and 1 binary signal,through the line(or wireless connection to the other party).In the local,call the function call request is encoded as an object,then the object is serialized as a series of bytes,the application layer protocol(usually HTTP)via the physical transmission medium(such as copper cable,optical fiber or radio)send out.On the remote machine,the application layer protocol decoding,the bytedeserialize the data obtained,to create a copy of the requested object.Then the data model is applied to the object and generates a response object.In order to make the response object is passed to the callback function local,all serialization deserialization operation,and the transport layer will be back again.Finally,the response object is passed to the function call local.This interactive process is very complex,but fortunately,it can be done.Modernprogramming environments such Java and Microsoft framework are built with this ability.However,the execution of remote calls,all these operations will still be in the internal execution.If we were using there mote invocation,performance will be affected.That is to say,a remote call is unlikely to have efficiency and local call.What is worse,the instability of network makes the efficiency loss is unpredictable,it is difficult to.In contrast,a local call to run on the local memory,will undoubtedly have an advantage more at this point.And so on,said remote call half a day,between this and the availability of software?The answer is,a relationship.A successful computer user interface must be able to at least level simulation weexperience in the real world.One of the basic rules of interaction is,when wepush,prick or poke about something,it will immediately response.Response timeas long as a little bit out a little,will make people confused,distracted,to shift thefocus from the task at hand to the user interface.Remote calls across the network,need to perform additional operations in great quantities,they tend to put the system to slow down,the user perceived delay.In desktop applications,only when the usability design is very bad,will appear this kind of makes users feel full of bug,unresponsive to the user interface,but in the application of network,what do not get a large number of such interface.Because the network delay is unpredictable,this kind of interface problems oftencome and go like a shadow,it is difficult to carry out the application responsetest.In other words,the network delay is the result of a common cause of the practical application of the interaction.User interface developers for network delay can only assume the worst.Say simply,is to try to make the user interface and network activities unrelated to.Programmers have already created a truly effective and proven solutions,tosolve this problem.To sell a Guan,let us into the real world.In the morning I will do,a very important is to wake my kids go to school.I can stand on the edge of the bed they toss up,chase them up and dressed,but thismethod is very time consuming,it takes me a lot of precious morning timeI want to wake up the children,have a look out the window,often neglected to feed the cat.After the children would ask me to breakfast.As the server process,the children always get up slowly.If I follow the synchronous interaction pattern,will they all day.However,as long as they mumble"I woke up",I can go to do other things,need to come back when they have a look.In computer terms,I need to do is for every child to establish an asynchronous process in a separate thread.After the start,the children will wake up in their ownthreads,the parent thread unnecessary synchronization wait,they afterwards will inform me(which is often asked me to eat).In the process they wake up,I don't need interaction and they,when they had been up and dressed myself,because I have reason to believe that they will do so soon.For any user interface,which is a long established practice,namely to createasynchronous thread,let it in the background who need to calculate a longtimetask,so that the user can continue to do other things.When starting this thread,it is necessary to block the user operation,but after a short period of time can beaccepted,will relieve congestion.Because of the existence of network delay,using asynchronous mode is a good practice to handle any time-consumingremote call.In fact,the network latency problems and solutions related to long-standing.In the old client/server mode,when the poor design of the client program met thehigh load of the server,the user interface will appear delay intolerable.Even in today's Internet era,when to switch the page,if the browser half the things not to,so this situation might be due to network delay caused by.The existing technical conditions,we have no way to remove the network delay,but at least onestrategy,that is the use of asynchronous processing remote calls,isn't it?Worse,for Web developers to do so there is a problem:HTTP protocol is a"request response"mode of the protocol.That is to say,the client requests a document,the server or a return to this document,or tell the client can not findthe document or allows a client to another place to find,also can tell which the client can use the local cache,and so on.To make a long story short,"request response"mode of the protocol is a one-way communication protocol.The clientinitiates a connection to the server,b ut the server can not initiates a connection to the client.Even when the next client,initiate the communication request,forgetful of the server can't remember this client is who(HTTP is a connectionless).Most Web developers to use modern programming language,for example,Java,PHP ,they are familiar with the user session(user session)concept,this is in fact the application server for a remedy can't maintain a connection state of the HTTP protocol.HTTP for the initial design goal well,using some clever processing,it can adapt to the beginning of the design did not consider theoccasion.But the key features of the asynchronous callback scheme of our clientis,will receive two notice,is a time in the thread creation,the other is a time in the end of the thread.The standard HTTP and the traditional Web application model can not provide these.The traditional Web application like Amazon,is built on the concept of the page.Show the user a document,which includes various links and form,the user canaccess further more documentation.This interaction model can support complex data sets on a large scale(like Amazon and other sites have demonstrated),which provides the user experience is enough to meet the needs of business.In ten years,this interaction model laid a deep imprint in our view of theapplication of Internet business.WYSIWYG interface(WYSIWYG)Web authoring tools,making the site more easily to be understood as a stack of pages.The framework of Web server using the state diagram conversion on the pagemodeling.no introduction,the traditional Web application that has been firmlybound in a page refresh operation,as if the refresh is behoove and inevitable,tried processing scheme for any asynchronous never.Of course,no doubt,the traditional Web application must not nothing is right..After all,Amazon in this interaction model to create a successful commercial applications.But this applies to the way Amazon does not necessarily apply to allpeople.Why do you say that?To understand this,we need to study the usermodel(usage pattern).A general discussion of the bicycle and SUV(SUV)merits meaningless.Because they have their own advantages and disadvantages--comfort,speed,fuel consumption or personal identity.Only discussed in particular use mode,this comparison is only meaningful.For example,is to in the rush hour through the center of the city,or to take the whole family,old and young to go on vacation,or just to find a shelter from the rain.In a similar situation like this,can we have a definite object in view to compare.For the user interface,it is the same with.Software usability expert Alan Cooper has written a lot of good articles aboutusage patterns,he defines two main uses:transient(transient)and exclusive(sovereign).Transient applications may use occasionally every day,butalways as a secondary activity,with a sudden.The contrast is sovereign applications,exclusive continued use of application to deal with the user for several hours a day.Many applications have a natural monopoly or transient properties.For example,a word processing software writing is a sovereign application,possible applications also use several transient,such as file management(file open andembed this function will often close the window),dictionary or spell checking tools(many word processing program is also embedded in these functions),andcolleagues contact email and chat tool.For software developers,text editor,debugger or IDE(integrated development environment)is the exclusive.Sovereign applications often use more frequently.Y ou know,a good userinterface is not visible.The measure of a good scale used frequently,is when theuser interface has obvious pause,it affects the user process.For example,from a directory to another directory file to 2 second pause,I can accept with pleasure;but if the two seconds is the place in my is full of passion for paintingsoftware to create an image,or I'm trying to debug a very difficult to deal with thegeneration of code certainly,this makes me feel very uncomfortable.Amazon is a transient application,eBay,Google and most large public Web applications are transient applications.Since the date of birth,the experts had predicted that the traditional desktop applications under Web impact.Over the past ten years,these have not occurred,why?Based on the Web page programfor transient applications is enough,but it is far from enough for a sovereign application.The starting of modern Web browsers and it's original point(a document from a remote server)has not matter,between them like a Swiss Army knife and neolithic hunting tools,it is a world of difference.A variety of interactive components,scripts and plug-ins,these years could not suppress the crazydevelopment,almost forced once again to create a new browsing experience.toprehistoric times visitbrowser.In 1993,netscape founded before the Marc Andreessen(founder of netscape)are lobbying Tim Berners-Lee(founder of Web,the W3C leader)et al.,cited good into a picture label is HTML.A few years ago,a few pioneers began to treat JavaScript as a serious programming language.But on the whole,more people still use it and those whomockwarning box"monkey tricks and click to win awards"advertising a classtogether.The browser wars brought JavaScript a misunderstood,sick children,Ajax can be viewed as his rehabilitation center.As long as the proper guidance,and thento frame it with appropriate,JavaScript will likely become the Internet model citizen.It can really enhance the practicability of Web application,and without forcing users to install additional software,or forcing users to abandon his beloved browser.To obtain mature tools are widely understood can help usachieve this goal.The back of the book design pattern is one such toolmentioned.The promotion and popularization of a new technology,is not only the technical matters,but also social behavior.Once the technology is mature,the people also need to understand how to use it.This step is often by using it to do our very familiar things start.For example,early bicycle called"Trojan wheel"or"pedalinghorse",on his feet tread the reaction force to move forward.As this technology is gradually accepted by the public,then inventors would invent a new way to use,add the pedal,brake,a chain wheel and tire.Each time the invention creation,made the bike in the shadow of more pale horse,that completely disappeared.The same process also occurs in the field of Web development.The technology behind the Ajax have the ability to Web pages into something new somethingcompletely different.Early uses of Ajax try to make Web pages is beginning to look like a"Trojan wheel"neither fish nor fowl.To comprehend the essence of Ajax,we have to forget about the Web page concept,that is to say,we have tobreak these years of experience.In the months after the Ajax officially named,such things have happened a lot.Ajax的应用花几分钟使用一下你选中的应用(浏览器除外),记下它用到了哪些用户交互,然后马上回来。
一、介绍xr-frame框架xr-frame框架是一种用于小程序开发的轻量级框架,它提供了一套简单易用的API,以实现小程序的快速开发和高效运行。
xr-frame框架基于原生小程序的开发环境,可以与原生小程序的开发技术很好地集成,同时也可以与其他小程序框架进行无缝对接。
二、xr-frame框架的特点1. 轻量级:xr-frame框架设计精简,功能模块化,占用空间小,加载速度快。
2. API丰富:xr-frame框架提供了丰富的API,包括页面生命周期、数据绑定、事件处理、网络请求、组件库等,满足了小程序开发中的各种需求。
3. 良好兼容性:xr-frame框架可以很好地兼容不同版本的信信小程序,保证了小程序在不同评台和不同设备上的稳定性和流畅性。
4. 可扩展性强:xr-frame框架支持自定义组件和插件,开发者可以根据需要进行灵活的扩展和定制。
5. 运行效率高:xr-frame框架采用了一些高效的机制,如虚拟DOM、数据diff算法等,可以提高小程序的运行效率。
6. 实用工具库:xr-frame框架提供了一些实用的工具函数和组件库,如日期处理、动画效果、图表库等,方便开发者进行快速开发。
三、xr-frame框架的使用步骤1. 安装xr-frame框架:在小程序项目中,通过npm命令安装xr-frame框架,然后在app.js中引入并初始化。
2. 创建页面:使用xr-frame框架提供的Page函数创建页面,其中包括页面的生命周期函数、数据绑定、事件处理等。
3. 开发组件:根据业务需求,使用xr-frame框架提供的Component 函数开发自定义组件,并在页面中引用。
4. 发起网络请求:使用xr-frame框架提供的网络请求API,可以方便地发起GET/POST请求,并处理返回的数据。
5. 页面跳转:使用xr-frame框架提供的路由API,可以实现页面之间的跳转和传参。
6. 调试和优化:在开发过程中,可以使用xr-frame框架提供的调试工具和性能监控工具,进行页面调试和优化。