Modular examples
Use these examples to build controls around a full modular configurator. Each example uses one <mmq-embed> and the public JavaScript API on window.mimeeqApp.
| Task | Example |
|---|---|
| List component products, number placed items and build a bill of materials | Read the scene and the catalog |
| Show open snaps and place a component at an end or inside a joint | Build your own add and insert flow |
| Show each item's options and apply a fabric to several items | Options for every item and apply-to-all |
| Put controls and labels beside placed items | Item toolbar and labels |
| Connect Undo and Redo buttons to the scene's history | Undo and redo |
| Build custom view, orbit and zoom controls | Camera controls |
Wait for the scene
Register the mimeeq-app-loaded listener on document before loading the embed script. This event signals that the first embed has loaded. The API is assigned earlier and emits mimeeq-api-installed on document. Subscribe to window.mimeeqApp.observers.status.firstRender before using the mounted 3D scene. For controls that edit the scene, also wait for status.settled to be true. See Read the scene and the catalog for the status fields.
Read and subscribe
observer.subscribe(({ newValue, oldValue }) => { … })emits the current value immediately. The first emission has nooldValue. Later emissions supply the previous value.observer.getValue()reads the current value synchronously. Code that reads before the runtime can supply data should handleundefinedas well as anynullor empty result documented for that observer.- Treat observer values as read-only snapshots. The new scene and modular data observers expose derived views of the current state. Keep your own copy if you need to edit a value locally. Use public actions to update the scene.
- Subscribe to the observers that drive your UI and unsubscribe when you remove the panel. Listen for Mimeeq events on
document.
See Programmatic Modular Scene Control for more scene and placement actions.
Identify products, items and snaps
| Field | Identifies | Example use |
|---|---|---|
productId | A component product in the catalog. Several placed items can share it. | Group identical product types or identify the product being placed. |
instanceId | One occurrence of a component in the current scene. | Look up that item's price or pass it to an item action. |
snapId | The snap mesh on a placed item. Another instance of the same product can have the same snap ID. | Combine it with instanceId to address a placement target. |
A configurationCode describes how an item is configured. Two instances can have the same configuration code and still occupy different positions.