由于Ajax的火爆,所以我会重点介绍与它相关的一些技术。下面的文档已经写了很久了,由于上一篇的尖括号搞的我非常之烦,现在才贴出来,见谅。
我将从Window,XMLHttpRequest等这几个主要接口出发(Document前面已经描述了),描述客户端Javascript编程的主要轮廓。另外,值得注意的是,这个领域的变化仍然非常剧烈,我不保证我描述的东西都可用。无论是现在(我描述的东西还太新)还是以后(而且还没有定型)。
interface XMLHttpRequest {
attribute EventListener onreadystatechange;
readonly attribute unsigned short readyState;
void open(in DOMString method, in DOMString uri);
void open(in DOMString method, in DOMString uri, in boolean async);
void open(in DOMString method, in DOMString uri, in boolean async, in DOMString user);
void open(in DOMString method, in DOMString uri, in boolean async, in DOMString user, in DOMString password);
void setRequestHeader(in DOMString header, in DOMString value) raises(DOMException);
void send(in DOMString data) raises(DOMException);
void send(in Document data) raises(DOMException);
void abort();
DOMString getAllResponseHeaders();
DOMString getResponseHeader(in DOMString header);
attribute DOMString responseText;
attribute Document responseXML;
attribute unsigned short status;
// raises(DOMException) on retrieval
attribute DOMString statusText;
// raises(DOMException) on retrieval
};
interface Item {
readonly attribute boolean exists;
readonly attribute DOMString name;
};
interface IntegerItem : Item {
readonly attribute long value;
};
interface BooleanItem : Item {
attribute boolean value;
};
interface StringItem : Item {
readonly attribute DOMString value;
};
interface ContentItem : Item {
attribute Node nodeArg;
attribute unsigned long offset;
};
interface Match {
// MatchTestGroup
const unsigned short IS_EQUAL = 0;
const unsigned short IS_NOT_EQUAL = 1;
const unsigned short INT_PRECEDES = 2;
const unsigned short INT_PRECEDES_OR_EQUALS = 3;
const unsigned short INT_FOLLOWS = 4;
const unsigned short INT_FOLLOWS_OR_EQUALS = 5;
const unsigned short STR_STARTS_WITH = 6;
const unsigned short STR_ENDS_WITH = 7;
const unsigned short STR_CONTAINS = 8;
const unsigned short SET_ANY = 9;
const unsigned short SET_ALL = 10;
const unsigned short SET_NOT_ANY = 11;
const unsigned short SET_NOT_ALL = 12;
readonly attribute unsigned short test;
};
interface MatchInteger : Match {
readonly attribute DOMString name;
readonly attribute long value;
};
interface MatchBoolean : Match {
readonly attribute DOMString name;
readonly attribute boolean value;
};
interface MatchString : Match {
readonly attribute DOMString name;
readonly attribute DOMString value;
};
interface MatchContent : Match {
readonly attribute DOMString name;
readonly attribute Node nodeArg;
readonly attribute unsigned long offset;
};
interface MatchSet : Match {
readonly attribute Node nodeArg;
void addMatch(in Match add);
Match getMatch(in unsigned long index);
};
interface Segment : Match {
attribute Match criteria;
attribute DOMString order;
void addItem(in Item add);
MatchString createMatchString(in unsigned short test, in DOMString name, in DOMString value);
MatchInteger createMatchInteger(in unsigned short test, in DOMString name, in long value);
MatchBoolean createMatchBoolean(in unsigned short test, in DOMString name, in boolean value);
MatchContent createMatchContent(in unsigned short test, in DOMString name, in unsigned long offset, in Node nodeArg);
MatchSet createMatchSet(in unsigned short test);
StringItem createStringItem(in DOMString name);
IntegerItem createIntegerItem(in DOMString name);
BooleanItem createBooleanItem(in DOMString name);
ContentItem createContentItem(in DOMString name);
void getItem(in unsigned long index);
boolean getNext();
};
interface View {
void select(in Node boundary, in unsigned long offset, in boolean extend, in boolean add);
Segment createSegment();
boolean matchFirstSegment(inout Segment todo) raises(DOMException);
long getIntegerProperty(in DOMString name) raises(DOMException);
DOMString getStringProperty(in DOMString name) raises(DOMException);
boolean getBooleanProperty(in boolean name) raises(DOMException);
Node getContentPropertyNode(in DOMString name) raises(DOMException);
unsigned long getContentPropertyOffset(in DOMString name) raises(DOMException);
};
interface VisualView {
readonly attribute DOMString fontScheme;
readonly attribute unsigned long width;
readonly attribute unsigned long height;
readonly attribute unsigned long horizontalDPI;
readonly attribute unsigned long verticalDPI;
VisualCharacter createVisualCharacter();
VisualCharacterRun createVisualCharacterRun();
VisualFrame createVisualFrame();
VisualImage createVisualImage();
VisualFormButton createVisualFormButton();
VisualFormField createVisualFormField();
void select(in Node boundary, n unsigned long offset, in boolean extend, in boolean add);
void matchSegment(in VisualResource segment);
};
interface VisualResource {
};
interface VisualFont : VisualResource {
attribute DOMString matchFontName;
readonly attribute boolean exists;
readonly attribute DOMString fontName;
boolean getNext();
};
interface VisualSegment : VisualResource {
attribute boolean matchPosition;
attribute boolean matchInside;
attribute boolean matchContaining;
attribute long matchX;
attribute long matchY;
attribute long matchXR;
attribute long matchYR;
attribute boolean matchContent;
attribute boolean matchRange;
attribute Node matchNode;
attribute unsigned long matchOffset;
attribute Node matchNodeR;
attribute unsigned long matchOffsetR;
attribute boolean matchContainsSelected;
attribute boolean matchContainsVisible;
readonly attribute boolean exists;
readonly attribute Node startNode;
readonly attribute unsigned long startOffset;
readonly attribute Node endNode;
readonly attribute unsigned long endOffset;
readonly attribute long topOffset;
readonly attribute long bottomOffset;
readonly attribute long leftOffset;
readonly attribute long rightOffset;
readonly attribute unsigned long width;
readonly attribute unsigned long height;
readonly attribute boolean selected;
readonly attribute boolean visible;
readonly attribute unsigned long foregroundColor;
readonly attribute unsigned long backgroundColor;
readonly attribute DOMString fontName;
readonly attribute DOMString fontHeight;
boolean getNext();
};
interface VisualCharacter : VisualSegment {
};
interface VisualCharacterRun : VisualSegment {
};
interface VisualFrame : VisualSegment {
readonly attribute VisualSegment embedded;
};
interface VisualImage : VisualSegment {
readonly attribute DOMString imageURL;
readonly attribute boolean isLoaded;
};
interface VisualFormButton : VisualSegment {
readonly attribute boolean isPressed;
};
interface VisualFormField : VisualSegment {
readonly attribute DOMString formValue;
};
interface EmbeddingElement {
readonly attribute dom::Document contentDocument;
readonly attribute Window contentWindow;
};
// behavior is always special in ECMAScript, this is defined only for the benefit
// of other languages
interface TimerListener {
// what to put here?
};
interface AbstractView {
readonly attribute DocumentView document;
};
interface DocumentView {
readonly attribute AbstractView defaultView;
};
interface Window : views::AbstractView {
// self-references
readonly attribute Window window;
readonly attribute Window self;
// assigning this has special behavior in ECMAScript, but it is otherwise
// read only. specifically, in ES a string URI can be assigned to location,
// having the same effect as location.assign(URI)
readonly attribute Location location;
// name attribute of referencing frame/iframe/object, or name passed to
// window.open
attribute dom::DOMString name;
// global object of containing document
readonly attribute Window parent;
// global object of outermost containing document
readonly attribute Window top;
// referencing <html:frame>, <html:iframe>, <html:object>, <svg:foreignObject>,
// <svg:animation> or other embedding point, or null if none
readonly attribute dom::Element frameElement;
// one-shot timer
long setTimeout(in TimerListener listener, in long milliseconds);
void clearTimeout(in long timerID);
// repeating timer
long setInterval(in TimerListener listener, in long milliseconds);
void clearInterval(in long timerID);
};
interface DocumentWindow : views::DocumentView {
readonly attribute Location location;
};
interface Location {
attribute dom::DOMString href;
// pieces of the URI, per the generic URI syntax
attribute dom::DOMString hash;
attribute dom::DOMString host;
attribute dom::DOMString hostname;
attribute dom::DOMString pathname;
attribute dom::DOMString port;
attribute dom::DOMString protocol;
attribute dom::DOMString search;
void assign(in dom::DOMString url);
void replace(in dom::DOMString url);
void reload();
dom::DOMString toString();
};
分享到:
相关推荐
WebApi和访问WebApi是开发过程中常见的两个概念,它们在构建分布式系统和提供网络服务时起着关键作用。本文将深入探讨这两个项目及其关联技术,包括WebApi的使用和通过HttpWebRequest类进行WebApi调用。 WebApi是...
在"C# WinForm调用WebAPI"的场景中,我们主要涉及到以下几个关键知识点: 1. **C# WinForm编程**:WinForm是.NET Framework的一部分,提供了一个用于创建交互式图形用户界面的平台。在C# WinForm应用中,我们可以...
"WebApplication1.rar"中的项目可能包含了从创建、路由到响应处理的整个Web API实现过程,为学习和理解Web API提供了实际的代码示例。通过深入学习和实践,开发者可以掌握构建高效、安全、易于维护的Web API服务的...
**Web API**(Application Programming Interface)是一种应用程序接口,它通过网络协议(如HTTP)来提供服务。在工业自动化领域,**西门子S7-200 SMART** 的Web API为用户提供了远程访问PLC的功能,使得开发者可以...
1. **API(Application Programming Interface)**:API是一组预定义的函数、方法或协议,用于软件之间进行通信。新浪API则提供了对新浪服务的各种操作接口。 2. **HTTP协议**:WebAPI通常基于HTTP或HTTPS协议,这...
首先,需要了解的是WebAPI项目的基本创建流程,即通过Visual Studio创建一个新的*** Web Application (.NET Framework)项目,选择WebAPI作为项目模板。创建项目后,我们会在项目中看到一个名为ValuesController的...
**C# Web API详解** C# Web API是微软.NET Framework的一部分,主要用于构建RESTful服务,它使得开发基于HTTP的应用程序变得更加简单。REST(Representational State Transfer)是一种软件架构风格,用于设计网络...
在IT行业中,Windows Forms(WinForms)是一种常用的桌面应用程序开发框架,而WebAPI则是用于构建RESTful服务的ASP.NET框架。本案例主要涉及如何在WinForm应用中通过HttpClient调用使用OAuth2.0授权的WebAPI接口。...
ASP.NET Web API 2 Recipes gives you an in-depth explanation for each of these scenarios and shows you how to use Web API with a vast array of .NET application development tools and external libraries...
Java调用WebAPI是开发过程中常见的任务,尤其是在分布式系统或者微服务架构中,不同服务间通过API进行数据交互。WebAPI通常指的是Web应用程序提供的接口,允许客户端(如Java应用)发送HTTP请求并接收响应。本压缩包...
在Web API中启用Session涉及到的是将传统的Web应用程序中的会话状态管理应用到API设计中。Web API通常是无状态的,因为它遵循RESTful架构原则,但有时我们可能需要在某些场景下存储客户端的状态信息,这时就需要考虑...
在开发Web应用时,API(应用程序接口)是服务器与客户端之间通信的重要桥梁。Web API通常由后端服务提供,允许前端应用获取数据或执行特定功能。然而,由于浏览器的同源策略限制,不同源的HTTP请求(即跨域请求)会...
这两个压缩文件可能是Web API服务器端项目的源代码(MvcApplication3.rar)和一个简单的Web API客户端示例(WebApiClient.rar)。你可以解压并研究这些代码,了解如何实际操作Web API服务和客户端的实现。 通过以上...
首先,在Global.asax.cs的Application_Start方法中,需要注册OAuth提供者和WebAPI路由: ```csharp public static void RegisterOAuth() { OAuthBearerTokensValidation.EnableForWebApi(GlobalConfiguration....
在本实例中,我们将深入探讨如何使用.NET WebAPI来创建一个简单的服务,该服务能够接收GET和POST请求,处理数据并返回响应。下面将详细阐述相关知识点。 1. **WebAPI简介** .NET WebAPI是ASP.NET框架的一部分,...
9. **WebApplication4.csproj.user**: 这是一个用户特定的项目设置文件,包含了开发者个人的IDE设置,如最近打开的文件列表,不包含在版本控制中。 通过分析这些文件,我们可以学习如何设置和运行一个基本的Web API...
Web API(Web Application Programming Interface)是一种通过HTTP协议提供服务的方式,它允许应用程序通过发送HTTP请求来获取、更新或操作数据。在此项目中,AutoIt3的功能被扩展以支持这种接口,从而增强了它的...
1. 创建项目:使用Visual Studio或其他开发工具,选择ASP.NET Web Application模板,并选择WebAPI作为项目类型。 2. 定义控制器:创建控制器类,继承自ApiController基类,然后添加处理HTTP请求的方法。 3. 实现操作...
assemblyFile: 'WebApplication1.dll', // 这应替换为实际的DLL文件路径 typeName: 'WebApplication1.Controllers.HomeController', methodName: 'Get' // 假设这是WebAPI控制器中的一个方法 }); dotNetFunction...