compact, modular JavaScript wrappers for ArcGIS Hub that run in Node.js and modern browsers.
The documentation is published at http://esri.github.io/hub.js/ (source code here).
You can install dependencies by cloning the repository and running:
npm install
Note: This project uses volta to manage node/npm versions. We strongly suggest you do, too :)
Afterward, for a list of all available commands run npm run
.
Some useful commands include:
npm test
runs all the tests and confirms the API is functioning as expected.Debug Node Tests
configuration in the .vscode/launch.json
which will run the Node tests in the VS Code debugger.npm run test:chrome:debug
runs all the tests in a browser, and will re-run when changes are made. Note: in some situations, spies/stubs will fail on subsequent test runs. We are not certain why this occurs, but the resolution is to stop/start the test runner.npm run docs:serve
will run the documentation site locally at http://localhost:3000npm run build
will run the ESM and CJS build for all the packages@esri/hub-common
- Common TypeScript types and utility functions.@esri/hub-discussions
- Module to interact with ArcGIS Hub Discussions API@esri/hub-downloads
- Helper functions for working with downloads.@esri/hub-events
- Helper functions for working with Events.@esri/hub-initiatives
- Helper functions for working with Initiatives.@esri/hub-search
- Helper functions for search on ArcGIS Online.@esri/hub-sites
- Helper functions for working with Sites, Pages and Domains.@esri/hub-surveys
- Helper functions for working with Surveys.@esri/hub-teams
- Helper functions for working with ArcGIS Online groups in a Hub context.@esri/hub-annotations
- Hub Annotations have been replaced with Hub Discussions, see @esri/hub-discussions
@esri/hub-auth
- moved to @esri/hub-common
@esri/hub-types
- moved to @esri/hub-common
@esri/hub-content
- moved to @esri/hub-common
hub.js
is designed as a set of data manipulation functions, not persistent objects with behavior. You should not use new
in conjunction with this library. Just include the modules your application needs and use them to hide lower-level abstractions for making API calls for hub related things. Your application should manage the state of the data you receive from these methods.
This project builds on the packages in arcgis-rest-js
, so if you want even lower-level access, you can also use them directly.
Persistent objects often introduce memory leaks in JavaScript applications. As soon as you instantiate a new
object, you need to consider its lifespan. If you happen to assign that object inside a closure or somewhere else long-lived, you might end up with references that cannot be destroyed by the garbage collector. Creating clean separation between functions-that-fetch-or-manipulate-data and application-state-as-a-javascript-object helps to avoid this problem.
We are aiming for functional equivalence to hub-py
so that the objects and capabilities are familiar, not necessarily to make the APIs identical.
More about Javascript Memory Leaks
If something isn't working the way you expected, please take a look at previously logged issues first. Have you found a new bug? Want to request a new feature? We'd love to hear from you.
If you're looking for help you can also post issues on GIS Stackexchange.
For transparency into the release cycle and in striving to maintain backward compatibility, @esri/hub.js is maintained under Semantic Versioning guidelines and will adhere to these rules whenever possible.
For more information on SemVer, please visit http://semver.org/.
See the release process document.
To assist you in your development efforts, we have recommended certain extensions for VScode. On editor load, you should see a pop up in the bottom right that will direct you to the download point.
If you have another useful extension that you'd like to recommend, add an entry to the recommendations
array in extensions.json
(hint: hitting cmd+i
while in the array will bring up a list of all your installed extensions). Submit a PR with your changes through the normal process.
Copyright © 2018-2024 Esri
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
A copy of the license is available in the repository's LICENSE file.