Skip to content

Commit

Permalink
Add the PerformanceObserver API into closure externs.
Browse files Browse the repository at this point in the history
Based on
https://w3c.github.io/performance-timeline/#dom-performanceobservercallback

Also add targetClientId and reservedClientId to the spec from
w3c/ServiceWorker#870

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164927249
  • Loading branch information
clayw authored and blickly committed Aug 11, 2017
1 parent 0db6565 commit eb9706b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
55 changes: 53 additions & 2 deletions externs/browser/w3c_navigation_timing.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ Performance.prototype.clearMarks = function(opt_markName) {};
* @param {string=} opt_endMark
* @return {undefined}
*/
Performance.prototype.measure =
function(measureName, opt_startMark, opt_endMark) {};
Performance.prototype.measure = function(
measureName, opt_startMark, opt_endMark) {};

/**
* @param {string=} opt_measureName
Expand All @@ -230,3 +230,54 @@ var performance;
* @extends {Performance}
*/
function WorkerPerformance() {}

/**
* @typedef {function(!PerformanceObserverEntryList, !PerformanceObserver): void}
*/
var PerformanceObserverCallback;

/**
* See:
* https://w3c.github.io/performance-timeline/#the-performanceobserver-interface
* @constructor
* @param {!PerformanceObserverCallback} callback
*/
function PerformanceObserver(callback) {}

/**
* @param {!PerformanceObserverInit} options
*/
PerformanceObserver.prototype.observe = function(options) {};

/** @return {void} */
PerformanceObserver.prototype.disconnect = function() {};

/**
* @record
*/
function PerformanceObserverInit() {}

/** @type {undefined|!Array<string>} */
PerformanceObserverInit.prototype.entryTypes;
/** @type {undefined|boolean} */
PerformanceObserverInit.prototype.buffered;

/**
* @constructor
*/
function PerformanceObserverEntryList() {}

/** @return {!Array<!PerformanceEntry>} */
PerformanceObserverEntryList.prototype.getEntries = function() {};
/**
* @param {string} type
* @return {!Array<!PerformanceEntry>}
*/
PerformanceObserverEntryList.prototype.getEntriesByName = function(type) {};
/**
* @param {string} name
* @param {string=} opt_type
* @return {!Array<!PerformanceEntry>}
*/
PerformanceObserverEntryList.prototype.getEntriesByType = function(
name, opt_type) {};
6 changes: 6 additions & 0 deletions externs/browser/w3c_serviceworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,12 @@ FetchEvent.prototype.clientId;
/** @type {!boolean} */
FetchEvent.prototype.isReload;

/** @type {?string} */
FetchEvent.prototype.targetClientId;

/** @type {?string} */
FetchEvent.prototype.reserveClientId;

/**
* @param {(Response|IThenable<Response>)} r
* @return {undefined}
Expand Down
2 changes: 1 addition & 1 deletion src/com/google/javascript/jscomp/resources.json

Large diffs are not rendered by default.

0 comments on commit eb9706b

Please sign in to comment.