Skip to content

Instantly share code, notes, and snippets.

@Braunson
Created November 24, 2023 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Braunson/35bc660599fbb768a3ccc6ddef420b3b to your computer and use it in GitHub Desktop.
Save Braunson/35bc660599fbb768a3ccc6ddef420b3b to your computer and use it in GitHub Desktop.
OBC IFC loader, on IFC loaded, show a disappearing 'Loaded the component' modal -- For https://github.com/IFCjs/components/
const ifcLoader = new OBC.FragmentIfcLoader(component)
ifcLoader.onIfcLoaded.add(() => {
// Create a new div element with the desired content
const messageDiv: HTMLDivElement = document.createElement('div');
messageDiv.textContent = 'Loaded the component';
messageDiv.style.position = 'fixed';
messageDiv.style.bottom = '10px';
messageDiv.style.left = '10px';
messageDiv.style.backgroundColor = 'lightgreen';
messageDiv.style.padding = '10px';
messageDiv.style.borderRadius = '5px';
messageDiv.style.zIndex = '1000';
// Append the div to the body
document.body.appendChild(messageDiv);
// Remove the div after 10 seconds
setTimeout(() => {
messageDiv.remove();
}, 10000);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment