web api 是在开发 web app 时有力的工具,下面展示了 html5 中的 web api,详细的用法可以参考 MDN web api 文档,后期会出一篇 web api 用法和兼容性的系列文章,通过一些小 demo 打开 web api 开发的大门,为我们的 web 应用增添更多的功能支持。
JavaScript Reserved Words
abstract | final | public |
boolean | finally | return |
break | float | short |
byte | for | static |
case | function | super |
catch | goto | switch |
char | if | synchronized |
class | implements | this |
const | import | throw |
continue | in | throws |
debugger | instanceof | transient |
default | int | true |
delete | interface | try |
do | long | typeof |
double | native | var |
else | new | void |
enum | null | volatile |
export | package | while |
extends | private | with |
false | protected |
List of HTML5 APIs for Coding with JavaScript
API | What It Does |
---|---|
Ambient Light API | Provides information about the ambient light levels, as detected by a device’s light sensor. |
Battery Status API | Provides information about the battery status of the device. |
Canvas 2D Context | Allows drawing and manipulation of graphics in a browser. |
Clipboard API | Provides access to the operating system’s copy, cut, and paste functionality. |
Contacts | Allows access to a user’s contacts repository in the web browser. |
Drag and Drop | Supports dragging and dropping items within and between browser windows. |
File API | Provides programs with secure access to the device’s file system. |
Forms | Gives programs access to the new data types defined in HTML5. |
Fullscreen API | Controls the use of the user’s full screen for web pages, without the browser user interface. |
Gamepad API | Supports input from USB gamepad controllers. |
Geolocation | Provides web applications with access to geographical location data about the user’s device. |
getUserMedia/Stream API | Provides access to external device data (such as webcam video). |
History API | Allows programs to manipulate the browser history. |
HTML Microdata | Provides a way to annotate content with computer-readable labels. |
Indexed database | Creates a simple client-side database system in the web browser. |
Internationalization API | Provides access to locale-sensitive formatting and string comparison. |
Offline apps | Allows programmers to make web apps available in offline mode. |
Proximity API | Provides information about the distance between a device and an object. |
Screen Orientation | Reads the screen orientation state (portrait or landscape) and gives programmers the ability to know when it changes and to lock it in place. |
Selection | Supports selecting elements in JavaScript using CSS-style selectors. |
Server-sent events | Allows the server to push data to the browser without the browser needing to request it. |
User Timing API | Gives programmers access to high-precision timestamps to measure the performance of applications. |
Vibration API | Allows access to the vibration functionality of the device. |
Web Audio API | API for processing and synthesizing audio. |
Web Messaging | Allows browser windows to communicate with each other across different origins. |
Web Speech API | Provides speech input and text-to-speech output features. |
Web storage | Allows the storage of key-value pairs in the browser. |
Web sockets | Opens an interactive communication session between the browser and server. |
Web Workers | Allows JavaScript to execute scripts in the background. |
XMLHttpRequest2 | Improves XMLHttpRequest to eliminate the need to work around the same-origin policy errors and to make XMLHttpRequest work with new features of HTML5. |
参考:MDN:Web APIs;
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。