Skip to content

Commit

Permalink
docs(OfflineLocalView): Add support for embedded data
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed Jun 26, 2023
1 parent ad566d9 commit 076fe91
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Examples/Applications/OfflineLocalView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import '@kitware/vtk.js/favicon';
import '@kitware/vtk.js/Rendering/OpenGL/Profiles/All';

import macro from '@kitware/vtk.js/macros';
import Base64 from '@kitware/vtk.js/Common/Core/Base64';
import DataAccessHelper from '@kitware/vtk.js/IO/Core/DataAccessHelper';
import HttpDataAccessHelper from '@kitware/vtk.js/IO/Core/DataAccessHelper/HttpDataAccessHelper';
import vtkFullScreenRenderWindow from '@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow';
Expand Down Expand Up @@ -100,6 +101,14 @@ export function load(container, options) {
dataAccessHelper.fetchJSON(null, 'index.json').then(onReady);
},
});
} else if (options.base64Str) {
const zipContent = Base64.toArrayBuffer(options.base64Str);
const dataAccessHelper = DataAccessHelper.get('zip', {
zipContent,
callback: (zip) => {
dataAccessHelper.fetchJSON(null, 'index.json').then(onReady);
},
});
}
}

Expand Down Expand Up @@ -161,3 +170,8 @@ setTimeout(() => {
initLocalFileLoader();
}
}, 100);

window.OfflineLocalView = {
initLocalFileLoader,
load,
};

0 comments on commit 076fe91

Please sign in to comment.