Skip to content

Instantly share code, notes, and snippets.

@leefsmp
Created October 30, 2015 14:31
Show Gist options
  • Save leefsmp/8fb342f5176e1fc8383c to your computer and use it in GitHub Desktop.
Save leefsmp/8fb342f5176e1fc8383c to your computer and use it in GitHub Desktop.
Downloading View & Data model for offline viewing
var lmv = new Lmv(config);
function onError(error) {
console.log("Error");
console.log(error);
}
function onInitialized(response) {
// downloads package to target directory,
// creates recursively if not exists
lmv.download(urn, '.test/data/download').then(
onDataDownloaded,
onError
);
}
function onDataDownloaded(items) {
console.log('Model downloaded successfully');
var path3d = items.filter(function(item){
return item.type === '3d';
});
console.log('3D Viewable path:');
console.log(path3d);
var path2d = items.filter(function(item){
return item.type === '2d';
});
console.log('2D Viewable path:');
console.log(path2d);
}
//start
lmv.initialize().then(onInitialized, onError);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment