Class: ImageEvent

ImageEvent


new ImageEvent()

An image event

Source:

Extends

Methods


<async> del()

Delete the image event, all 3 representations of it
passing only the one of the three URLs

Overrides:
  • NXMEvent#del
Source:
Returns:
Type
Promise
Example

Delete the imageEvent

 imageEvent.del().then(() => {
   console.log("image event deleted");
 }).catch((error)=>{
	console.log("error deleting image event  ", error);
 });

delivered()

Set the imageEvent status to 'delivered'

Overrides:
  • NXMEvent#delivered
Source:
Returns:
Type
Promise
Example

Set the imageEvent status to 'delivered'

 imageEvent.delivered().then(() => {
   console.log("image event status set to delivered");
 }).catch((error)=>{
	console.log("error setting image event status to delivered  ", error);
 });

<async> fetchImage(type, representations)

Download an Image from Media service //3 representations

Parameters:
Name Type Argument Default Description
type string <optional>
"thumbnail"

original, medium, or thumbnail

representations string <optional>
this.body.representations

the ImageEvent.body for the image to download

Source:
Returns:

the dataUrl "data:image/jpeg;base64..."

Type
string
Example

Downloading an image from the imageEvent

 imageEvent.fetchImage("medium").then((imageData) => {
   const img = new Image();
   img.src = imageData;
   document.body.appendChild(img);
 }).catch((error)=>{
	console.log("error getting image ", error);
 });

seen()

Set the imageEvent status to 'seen'

Overrides:
  • NXMEvent#seen
Source:
Returns:
Type
Promise
Example

Set the imageEvent status to 'seen'

 imageEvent.seen().then(() => {
   console.log("image event status set to seen");
 }).catch((error)=>{
	console.log("error setting image event status to seen ", error);
 });