Three new javascriptapis you may want to use

Source: Internet
Author: User
: This article mainly introduces three new javascriptapis you may want to use. For more information about PHP tutorials, see. If you are an old SitePoint reader and a fan of me, you already know that I have written many articles about HTML5 and JS APIs. So far, I have released some APIs that you can use now, although polyfill may be used. Click here if you do not know what polyfill is .)

But today I may want to break this rule to introduce some APIs that are still in the initial stage. You must know that these APIs are very new, and both of them were just released a few days ago. Because of this, these APIs are currently unavailable. However, if you are interested in understanding what they are used for, you can continue to read the following detailed descriptions about them. you are also welcome to leave your comments and responses.

Not to mention nonsense. start now!

Web Alarms API

The Web Alarms API allows you to configure device alert settings to schedule notification messages or enable a specific application to start at a specified time point. The most typical use of this API involves an alarm, calendar, or any other program that requires specific operations at a specific time.

Since last year, this API has just become a W3C design draft. Therefore, all the details to be officially recommended by W3C are still in the initial stage. This API needs to be used through the alarms attribute under the window. navigator object. The alarms attribute provides three functions:

GetAll (): Get all existing alarms from the device and return the alarms in the form of an array containing the Alarm object.

Add (): registers an alert message based on the Date object and returns an AlarmRequest object.

Remove (): removes a previously registered alarm by using a unique ID (the uniqueness is only for the application itself)

To demonstrate how to use these functions in ideal cases, here is an example of adding an alarm (Please remember that this code is not supported by any browser currently)

View sourceprint?

Var alarmId;

Var request = navigator. alarms. add (

New Date ("June 29,201 2 07:30:00 "),

"RespectTimezone ",

);

Request. onsuccess = function (e ){

AlarmId = e.tar get. result;

};

Request. onerror = function (e ){

Alert(e.tar get. error. name );

};

If you want to know

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.