Skip to content

Commit

Permalink
Add ToggleEvent and ToggleEventInit to HTML externs.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 710155291
  • Loading branch information
Closure Team authored and copybara-github committed Dec 28, 2024
1 parent 63dc6c0 commit 1696e6d
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 0 deletions.
28 changes: 28 additions & 0 deletions externs/browser/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -6500,3 +6500,31 @@ ViewTransition.prototype.updateCallbackDone;

/** @return {undefined} */
ViewTransition.prototype.skipTransition = function() {};

/**
* @record
* @extends {EventInit}
* @see https://html.spec.whatwg.org/multipage/interaction.html#toggleeventinit
*/
function ToggleEventInit() {}

/** @type {undefined|string} */
ToggleEventInit.prototype.newState;

/** @type {undefined|string} */
ToggleEventInit.prototype.oldState;

/**
* @param {string} type
* @param {ToggleEventInit=} opt_eventInitDict
* @see https://html.spec.whatwg.org/multipage/interaction.html#toggleevent
* @constructor
* @extends {Event}
*/
function ToggleEvent(type, opt_eventInitDict) {}

/** @const {string} */
ToggleEvent.prototype.newState;

/** @const {string} */
ToggleEvent.prototype.oldState;
116 changes: 116 additions & 0 deletions externs/browser/weblocksapi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Copyright 2018 The Closure Compiler Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Definitions for objects in the Web Locks API. Details of the
* API are at:
* https://wicg.github.io/web-locks/
*
* @externs
* @author ohsnapitscolin@google.com (Colin Dunn)
*/

/**
* Possible values are "shared" and "exclusive".
* @typedef {string}
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
*/
var LockMode;


/**
* @interface
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
*/
function Lock() {}

/** @const {string} */
Lock.prototype.name;

/** @const {!LockMode} */
Lock.prototype.mode;


/**
* @typedef {{
* name: string,
* mode: !LockMode,
* clientId: string
* }}
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
*/
var LockInfo;


/**
* @typedef {{
* mode: (!LockMode|undefined),
* ifAvailable: (boolean|undefined),
* steal: (boolean|undefined),
* signal: (!AbortSignal|undefined)
* }}
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
*/
var LockOptions;


/**
* @typedef {{
* held: !Array<!LockInfo>,
* pending: !Array<!LockInfo>
* }}
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
*/
var LockManagerSnapshot;


/**
* @typedef {(function(?Lock) : !Promise<*>)}
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
*/
var LockGrantedCallback;


/**
* @interface
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
*/
function LockManager() {}
/**
* @param {string} name
* @param {(!LockOptions|!LockGrantedCallback)} optionsOrCallback
* @param {!LockGrantedCallback=} callback
* @return {!Promise<*>}
*/
LockManager.prototype.request = function(name, optionsOrCallback, callback) {};

/**
* @return {!Promise<!LockManagerSnapshot>}
*/
LockManager.prototype.query = function() {};


/**
* @type {!LockManager}
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
*/
Navigator.prototype.locks;


/**
* @type {!LockManager}
* [Web Locks API Spec](https://wicg.github.io/web-locks/#idl-index)
*/
WorkerNavigator.prototype.locks;

0 comments on commit 1696e6d

Please sign in to comment.