Skip to main content

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.

TaskExample
List component products, number placed items and build a bill of materialsRead the scene and the catalog
Show open snaps and place a component at an end or inside a jointBuild your own add and insert flow
Show each item's options and apply a fabric to several itemsOptions for every item and apply-to-all
Put controls and labels beside placed itemsItem toolbar and labels
Connect Undo and Redo buttons to the scene's historyUndo and redo
Build custom view, orbit and zoom controlsCamera 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 no oldValue. Later emissions supply the previous value.
  • observer.getValue() reads the current value synchronously. Code that reads before the runtime can supply data should handle undefined as well as any null or 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​

FieldIdentifiesExample use
productIdA component product in the catalog. Several placed items can share it.Group identical product types or identify the product being placed.
instanceIdOne occurrence of a component in the current scene.Look up that item's price or pass it to an item action.
snapIdThe 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.