How to use the @nteract/commutable.createFrozenMediaBundle function in @nteract/commutable

To help you get started, we’ve selected a few @nteract/commutable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nteract / nteract / packages / reducers / src / core / entities / contents / notebook.ts View on Github external
const updateOutput = (output: any) => {
    if (output) {
      // We already have something here, don't change the other fields
      return output.merge({
        data: createFrozenMediaBundle(content.data),
        metadata: fromJS(content.metadata || {})
      });
    } else if (content.output_type === "update_display_data") {
      // Nothing here and we have no valid output, just create a basic output
      return {
        data: createFrozenMediaBundle(content.data),
        metadata: fromJS(content.metadata || {}),
        output_type: "display_data"
      };
    } else {
      // Nothing here, but we have a valid output
      return createImmutableOutput(content);
    }
  };