Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Esri/hub.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

npm version build status Coverage Status apache licensed

@esri/hub.js

compact, modular JavaScript wrappers for ArcGIS Hub that run in Node.js and modern browsers.

NOTE: This repository has been archived because the only hub.js that is currently in use, @esri/hub-common is no longer being developed here. That package is still under active development and being published to NPM, but it is not currently open source. If there is interest we can set up an open source mirror for that package.

Table of Contents

API Reference

The documentation is published at http://esri.github.io/hub.js/ (source code here).

Instructions

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.
  • There is also a 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:3000
  • npm run build will run the ESM and CJS build for all the packages

Packages

Hub.js used to be a collection of packages, but all the current functionality has been moved into a single package, @esri/hub-common.

You can import only the functions you need from this tree-shakable package.

Deprecated Packages

The functions and types from the following packages have been moved into other packages:

The following packages have been archived w/o moving their functions into another package as they support workflows that have been replaced by the Hub entity classes in @esri/hub-common. The last published version of these packages on NPM rely on version 20.x of @esri/hub-common. As major versions of @esri/hub-common are released with breaking changes, it is possible that these packages will stop working:

Design Philosophy

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.

Why Not Objects?

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

Frequently Asked Questions

Issues

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.

Versioning

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/.

Contributing

Release Process

See the release process document.

Recommended Extensions

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.

License

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

http://www.apache.org/licenses/LICENSE-2.0

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.

About

TypeScript wrappers for talking to ArcGIS Hub

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors 48

Languages