UNPKG

@mui/x-data-grid

Version:

The Community plan edition of the MUI X Data Grid components.

23 lines (22 loc) 715 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPublicApiRef = getPublicApiRef; const publicApiRefCache = new WeakMap(); function getPublicApiRef(apiRef) { const privateApi = apiRef.current; let publicApiRef = publicApiRefCache.get(privateApi); if (!publicApiRef) { // The ref is cached per grid instance and getter-based so that `publishEvent` // (called for every grid event) doesn't allocate, and so that consumers cannot // re-point the grid's internal ref through it. publicApiRef = { get current() { return privateApi.getPublicApi(); } }; publicApiRefCache.set(privateApi, publicApiRef); } return publicApiRef; }