Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function ensureRendered(callback: () => void): void {
for (let e of EditorWidget.editors) {
e.setOption('viewportMargin', Infinity);
}
window.requestAnimationFrame(() => {
// Assume entire viewport has been rendered now
callback();
for (let e of EditorWidget.editors) {
// Reset to default according to docs
e.setOption('viewportMargin', 10);
}
});
}
window.requestAnimationFrame(() => {
// Assume entire viewport has been rendered now
callback();
for (let e of EditorWidget.editors) {
// Reset to default according to docs
e.setOption('viewportMargin', 10);
}
});
}