files/en-us/web/api/gpubuffer/mapstate/index.md
{{APIRef("WebGPU API")}}{{SecureContext_Header}}{{AvailableInWorkers}}
The mapState read-only property of the
{{domxref("GPUBuffer")}} interface represents the mapped state of the GPUBuffer.
An enumerated value. Possible values are:
unmapped
GPUBuffer in JavaScript. This could be because:
GPUBuffer was previously mapped, and then unmapped again with {{domxref("GPUBuffer.unmap()")}}.pending
GPUBuffer in JavaScript.mapped
GPUBuffer in JavaScript.const stagingBuffer = device.createBuffer({
size: BUFFER_SIZE,
usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST,
});
console.log(stagingBuffer.mapState); // "unmapped"
// …
await stagingBuffer.mapAsync(
GPUMapMode.READ,
0, // Offset
BUFFER_SIZE, // Length
);
console.log(stagingBuffer.mapState); // "mapped"
{{Specifications}}
{{Compat}}