The image content ImageData JSON object, which is accessible as MicrioImage.data as the SvelteStore.Writable store, and MicrioImage.$data for its current value.
This JSON data includes, for all published languages for this image:
To access the data of the current viewed image, use:
// The current shown image value of the .data store Writableconst data = micrio.$current.$data;if(data) console.log(`The current image has ${data.markers.length} markers!`);else console.warn('The current image has no data set.'); Copy
// The current shown image value of the .data store Writableconst data = micrio.$current.$data;if(data) console.log(`The current image has ${data.markers.length} markers!`);else console.warn('The current image has no data set.');
To subscribe to any data changes:
micrio.$current.data.subscribe(data => { console.log('Image has new or updated data!', data);}) Copy
micrio.$current.data.subscribe(data => { console.log('Image has new or updated data!', data);})
To set your own custom data:
micrio.$current.data.set({ "markers": [ { "i18n": { "en": { "title": "This is a test marker!" } }, "x": .5, "y": .5 } ]}) Copy
micrio.$current.data.set({ "markers": [ { "i18n": { "en": { "title": "This is a test marker!" } }, "x": .5, "y": .5 } ]})
Or to update an existing loaded data object:
micrio.$current.data.update(data => { data.markers.push({ "i18n": { "en": { "title": "This is a newly added marker" } }, "x": .6, "y": .5 }); return data;}) Copy
micrio.$current.data.update(data => { data.markers.push({ "i18n": { "en": { "title": "This is a newly added marker" } }, "x": .6, "y": .5 }); return data;})
Image content data
The image content ImageData JSON object, which is accessible as MicrioImage.data as the SvelteStore.Writable store, and MicrioImage.$data for its current value.
This JSON data includes, for all published languages for this image:
To access the data of the current viewed image, use:
To subscribe to any data changes:
To set your own custom data:
Or to update an existing loaded data object: