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 1 commit
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
25 changes: 22 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,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)) {
console.log(entryType + " is not supported by PerformanceObserver!");
}
}
}
detectSupport(["resource", "mark", "measure"]);
npm1 marked this conversation as resolved.
Show resolved Hide resolved
const observer = new PerformanceObserver(list =&gt; {
list
.getEntries()
Expand All @@ -151,12 +160,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.
// Maybe disconnect after processing the events.
npm1 marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -313,6 +322,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 @@ -430,6 +440,15 @@ <h2><dfn>disconnect()</dfn> method</h2>
<a>relevant global object</a>, and also empty <a>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 <a>supportedEntryTypes</a>'s attribute getter must return a list
npm1 marked this conversation as resolved.
Show resolved Hide resolved
of entry types which the user agent supports for the
npm1 marked this conversation as resolved.
Show resolved Hide resolved
<a>PerformanceObserver</a> interface. This attribute allows web
developers to easily know which entry types are supported by the user
agent and to discover the entry types that exist and are supported by
the user agent.</p>
npm1 marked this conversation as resolved.
Show resolved Hide resolved
</section>
</section>
</section>
<section>
Expand Down