Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshots #29

Closed
miralemd opened this issue May 13, 2019 · 0 comments
Closed

Snapshots #29

miralemd opened this issue May 13, 2019 · 0 comments
Labels
api-stardust JavaScript library for building mashups
Milestone

Comments

@miralemd
Copy link
Contributor

Snapshots play a key role in exporting images and storytelling.

When a component is exported, a snapshot is taken of the current layout and is then rendered in the backend using that layout. This works fairly well as long as the enigma model is not used to e.g. fetch more data.

The developer should therefore be allowed to control what is included in the snapshot in order to reproduce the state of the component without the presence of a backend.

component: {
  render({ layout, context }) {
    if (layout.additionalData) { // assume a snapshot is being rendered
      // render stuff
    } else if (context.permissions.indexOf('fetch') !== -1) { // access to engine is permitted
      this.model.getHyperCubeData(/* */).then((pages) => {
        this.additionalData = pages; // temporarily store the data
      });
    }
  },
  takeSnapshot({ layout }) {
    // store the additional data
    layout.additionalData = this.additionalData;
  }
}

Related to #26

@miralemd miralemd mentioned this issue May 13, 2019
@miralemd miralemd added this to the 1.0.0 milestone Nov 5, 2019
@miralemd miralemd modified the milestones: 1.0.0, 1.x Jun 4, 2020
@miralemd miralemd added api-stardust JavaScript library for building mashups and removed supernova labels Jul 2, 2020
@Caele Caele closed this as completed Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-stardust JavaScript library for building mashups
Projects
None yet
Development

No branches or pull requests

2 participants