files/en-us/web/api/webgl2renderingcontext/beginquery/index.md
{{APIRef("WebGL")}}{{AvailableInWorkers}}
The WebGL2RenderingContext.beginQuery() method of the WebGL 2 API starts an asynchronous query. The
target parameter indicates which kind of query to begin.
beginQuery(target, query)
target
gl.ANY_SAMPLES_PASSED
gl.ANY_SAMPLES_PASSED_CONSERVATIVE
gl.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN
query
None ({{jsxref("undefined")}}).
const query = gl.createQuery();
gl.beginQuery(gl.ANY_SAMPLES_PASSED, query);
// …
{{Specifications}}
{{Compat}}