Skip to content

Commit 1696e6d

Browse files
Closure Teamcopybara-github
Closure Team
authored andcommitted
Add ToggleEvent and ToggleEventInit to HTML externs.
PiperOrigin-RevId: 710155291
1 parent 63dc6c0 commit 1696e6d

File tree

2 files changed

+144
-0
lines changed

2 files changed

+144
-0
lines changed

externs/browser/html5.js

+28
Original file line numberDiff line numberDiff line change
@@ -6500,3 +6500,31 @@ ViewTransition.prototype.updateCallbackDone;
65006500

65016501
/** @return {undefined} */
65026502
ViewTransition.prototype.skipTransition = function() {};
6503+
6504+
/**
6505+
* @record
6506+
* @extends {EventInit}
6507+
* @see https://html.spec.whatwg.org/multipage/interaction.html#toggleeventinit
6508+
*/
6509+
function ToggleEventInit() {}
6510+
6511+
/** @type {undefined|string} */
6512+
ToggleEventInit.prototype.newState;
6513+
6514+
/** @type {undefined|string} */
6515+
ToggleEventInit.prototype.oldState;
6516+
6517+
/**
6518+
* @param {string} type
6519+
* @param {ToggleEventInit=} opt_eventInitDict
6520+
* @see https://html.spec.whatwg.org/multipage/interaction.html#toggleevent
6521+
* @constructor
6522+
* @extends {Event}
6523+
*/
6524+
function ToggleEvent(type, opt_eventInitDict) {}
6525+
6526+
/** @const {string} */
6527+
ToggleEvent.prototype.newState;
6528+
6529+
/** @const {string} */
6530+
ToggleEvent.prototype.oldState;

externs/browser/weblocksapi.js

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
* Copyright 2018 The Closure Compiler Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
/**
17+
* @fileoverview Definitions for objects in the Web Locks API. Details of the
18+
* API are at:
19+
* https://wicg.github.io/web-locks/
20+
*
21+
* @externs
22+
* @author [email protected] (Colin Dunn)
23+
*/
24+
25+
/**
26+
* Possible values are "shared" and "exclusive".
27+
* @typedef {string}
28+
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
29+
*/
30+
var LockMode;
31+
32+
33+
/**
34+
* @interface
35+
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
36+
*/
37+
function Lock() {}
38+
39+
/** @const {string} */
40+
Lock.prototype.name;
41+
42+
/** @const {!LockMode} */
43+
Lock.prototype.mode;
44+
45+
46+
/**
47+
* @typedef {{
48+
* name: string,
49+
* mode: !LockMode,
50+
* clientId: string
51+
* }}
52+
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
53+
*/
54+
var LockInfo;
55+
56+
57+
/**
58+
* @typedef {{
59+
* mode: (!LockMode|undefined),
60+
* ifAvailable: (boolean|undefined),
61+
* steal: (boolean|undefined),
62+
* signal: (!AbortSignal|undefined)
63+
* }}
64+
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
65+
*/
66+
var LockOptions;
67+
68+
69+
/**
70+
* @typedef {{
71+
* held: !Array<!LockInfo>,
72+
* pending: !Array<!LockInfo>
73+
* }}
74+
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
75+
*/
76+
var LockManagerSnapshot;
77+
78+
79+
/**
80+
* @typedef {(function(?Lock) : !Promise<*>)}
81+
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
82+
*/
83+
var LockGrantedCallback;
84+
85+
86+
/**
87+
* @interface
88+
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
89+
*/
90+
function LockManager() {}
91+
/**
92+
* @param {string} name
93+
* @param {(!LockOptions|!LockGrantedCallback)} optionsOrCallback
94+
* @param {!LockGrantedCallback=} callback
95+
* @return {!Promise<*>}
96+
*/
97+
LockManager.prototype.request = function(name, optionsOrCallback, callback) {};
98+
99+
/**
100+
* @return {!Promise<!LockManagerSnapshot>}
101+
*/
102+
LockManager.prototype.query = function() {};
103+
104+
105+
/**
106+
* @type {!LockManager}
107+
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
108+
*/
109+
Navigator.prototype.locks;
110+
111+
112+
/**
113+
* @type {!LockManager}
114+
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
115+
*/
116+
WorkerNavigator.prototype.locks;

0 commit comments

Comments
 (0)