feat(loader): separated object loader into separate package
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
* Simple client that streams object info from a Speckle Server.
|
||||
* TODO: This should be split from the viewer into its own package.
|
||||
*/
|
||||
|
||||
export default class ObjectLoader {
|
||||
|
||||
constructor( { serverUrl, streamId, token, objectId } ) {
|
||||
@@ -12,10 +13,15 @@ export default class ObjectLoader {
|
||||
this.streamId = streamId
|
||||
this.objectId = objectId
|
||||
this.token = token || localStorage.getItem( 'AuthToken' )
|
||||
|
||||
this.headers = {
|
||||
'Authorization': `Bearer ${this.token}`,
|
||||
'Accept': 'text/plain'
|
||||
}
|
||||
|
||||
if( token ) {
|
||||
this.headers['Authorization'] = `Bearer ${this.token}`
|
||||
}
|
||||
|
||||
this.requestUrl = `${this.serverUrl}/objects/${this.streamId}/${this.objectId}`
|
||||
this.promises = []
|
||||
this.intervals = {}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@speckle/objectloader",
|
||||
"version": "2.0.0",
|
||||
"description": "Simple API helper to stream in objects from the Speckle Server.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "AEC Systems",
|
||||
"license": "SEE LICENSE NOTE IN readme.md"
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@speckle/viewer",
|
||||
"version": "2.0.0",
|
||||
"description": "Speckle js utilities.",
|
||||
"description": "A 3d viewer for Speckle, based on threejs.",
|
||||
"main": "dist/Speckle.js",
|
||||
"files": [
|
||||
"dist"
|
||||
@@ -34,7 +34,8 @@
|
||||
"webpack": "5.11.0",
|
||||
"webpack-cli": "^4.3.1",
|
||||
"webpack-dev-server": "^3.11.1",
|
||||
"yargs": "^10.0.3"
|
||||
"yargs": "^10.0.3",
|
||||
"@speckle/objectloader": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"camera-controls": "^1.26.0",
|
||||
|
||||
@@ -14,12 +14,16 @@ Comprehensive developer and user documentation can be found in our:
|
||||
|
||||
## Getting started
|
||||
|
||||
Note, these are WIP instructions. For development purposes, to start a webpack live reload server run:
|
||||
Note, these are WIP instructions. More details coming soon!
|
||||
|
||||
For development purposes, to start a webpack live reload server run:
|
||||
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
You can now access the example at [http://localhost:9000/example.html](http://localhost:9000/example.html).
|
||||
|
||||
To build the library, you should run:
|
||||
|
||||
```
|
||||
@@ -32,4 +36,4 @@ If in trouble, the Speckle Community hangs out on [the forum](https://speckle.co
|
||||
|
||||
## License
|
||||
|
||||
Unless otherwise described, the code in this repository is licensed under the Apache-2.0 License. Please note that some modules, extensions or code herein might be otherwise licensed. This is indicated either in the root of the containing folder under a different license file, or in the respective file's header. If you have any questions, don't hesitate to get in touch with us via [email](mailto:hello@speckle.systems).
|
||||
Unless otherwise described, the code in this repository is licensed under the Apache-2.0 License. If you have any questions, don't hesitate to get in touch with us via [email](mailto:hello@speckle.systems).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
import Viewer from './modules/Viewer'
|
||||
import ObjectLoader from './modules/ObjectLoader'
|
||||
import ObjectLoader from '@speckle/objectloader'
|
||||
import Converter from './modules/Converter'
|
||||
|
||||
let v = new Viewer( { container: document.getElementById( 'renderer' ), showStats: true } )
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import Viewer from './modules/Viewer'
|
||||
import ObjectLoader from './modules/ObjectLoader'
|
||||
import Converter from './modules/Converter'
|
||||
|
||||
export { Viewer, ObjectLoader, Converter }
|
||||
export { Viewer, Converter }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import ObjectLoader from './ObjectLoader'
|
||||
import ObjectLoader from '@speckle/objectloader'
|
||||
import Converter from './Converter'
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# The Speckle Object Loader
|
||||
|
||||
[](https://twitter.com/SpeckleSystems) [](https://speckle.community) [](https://speckle.systems) [](https://speckle.guide/dev/)
|
||||
|
||||
## Documentation
|
||||
|
||||
Comprehensive developer and user documentation can be found in our:
|
||||
|
||||
#### 📚 [Speckle Docs website](https://speckle.guide/dev/)
|
||||
|
||||
## Getting started
|
||||
|
||||
This module is meant to simply help you stream objects from a Speckle Server by using the "efficient" download endpoint.
|
||||
|
||||
It is currently used in [the 3d viewer](../viewer). Please check there for example usage!
|
||||
|
||||
More details coming soon!
|
||||
|
||||
## Community
|
||||
|
||||
If in trouble, the Speckle Community hangs out on [the forum](https://speckle.community). Do join and introduce yourself! We're happy to help.
|
||||
|
||||
## License
|
||||
|
||||
Unless otherwise described, the code in this repository is licensed under the Apache-2.0 License. If you have any questions, don't hesitate to get in touch with us via [email](mailto:hello@speckle.systems).
|
||||
Reference in New Issue
Block a user