Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define supportedEntryTypes #108

Merged
merged 10 commits into from
Nov 27, 2018
Merged
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 37 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ <h2>Introduction</h2>
&lt;body&gt;
&lt;img id="image0" src="https://www.w3.org/Icons/w3c_main.png" /&gt;
&lt;script&gt;
// Know when the entry types we would like to use are not supported.
function detectSupport(entryTypes) {
for (const entryType of entryTypes) {
if (!PerformanceObserver.supportedEntryTypes.includes(entryType)) {
// Indicate to client-side analytics that |entryType| is not supported.
}
}
}
detectSupport(["resource", "mark", "measure"]);
npm1 marked this conversation as resolved.
Show resolved Hide resolved
const observer = new PerformanceObserver(list =&gt; {
list
.getEntries()
Expand All @@ -127,12 +136,12 @@ <h2>Introduction</h2>
};
return JSON.stringify(obj, null, 2);
})
// Display them to the console
// Display them to the console.
.forEach(console.log);
// maybe disconnect after processing the events.
// Disconnect after processing the events.
observer.disconnect();
});
// retrieve buffered events and subscribe to new events
// Retrieve buffered events and subscribe to new events
// for Resource-Timing and User-Timing
observer.observe({
entryTypes: ["resource", "mark", "measure"],
Expand Down Expand Up @@ -298,6 +307,7 @@ <h2>The <dfn>PerformanceObserver</dfn> interface</h2>
void observe (PerformanceObserverInit options);
void disconnect ();
PerformanceEntryList takeRecords();
static readonly attribute FrozenArray&lt;DOMString&gt; supportedEntryTypes;
npm1 marked this conversation as resolved.
Show resolved Hide resolved
};
</pre>
<p class="note">To keep the performance overhead to minimum the
Expand Down Expand Up @@ -428,6 +438,22 @@ <h2><dfn>disconnect()</dfn> method</h2>
"WHATWG-DOM#context-object">context object</a>'s <a>observer
buffer</a>.</p>
</section>
<section>
<h2><dfn>supportedEntryTypes</dfn> attribute</h2>
npm1 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

@yoavweiss yoavweiss Nov 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you want 2 <dfn> to the same attribute, so this should probably be an <a> (with the dfn being in the paragraph below)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the dfn to the place where attribute getter is described. However, there's not quite repetition. There's supportedEntryTypes, the attribute, and supported entry types, the list maintained by the user agent which is used as the return value.

<p>The user agent MUST maintain <dfn>supported entry types</dfn>, a list
of strings representing the entry types which the user agent supports
for the <a>PerformanceObserver</a> interface. This list is populated by
npm1 marked this conversation as resolved.
Show resolved Hide resolved
specifications that define new entry types via the
<a href="#register-performance-entry-type"></a> algorithm.</p>
<p>When <a>supportedEntryTypes</a>'s attribute getter is called, run the following steps:</p>
<ol>
<li>Let <var>result</var> be a copy of the user agent's <a>supported entry types</a>.</li>
<li>Sort <var>result</var> in alphabetical order.</li>
<li>Return <var>result</var>.</li>
</ol>
<p class="note">This attribute allows web developers to easily know
which entry types are supported by the user agent.</p>
</section>
</section>
</section>
<section>
Expand Down Expand Up @@ -543,6 +569,14 @@ <h2>Filter <var>buffer</var> by <var>name</var> and <var>type</var></h2>
</li>
</ol>
</section>
<section data-link-for="PerformanceObserver">
<h2>Register performance entry type</h2>
<p>To register a performance entry type, run the following steps:</p>
npm1 marked this conversation as resolved.
Show resolved Hide resolved
<ol>
<li>Let <var>type</var> be the input string.</li>
<li>Append <var>type</var> to <a>supported entry types</a>.</li>
</ol>
</section>
</section>
<section id="privacy-security">
<h3>Privacy and Security</h3>
Expand Down