Hands on

Introducing GitHub and JSFiddle Support for JavaScript API Examples

By Michael Palermo | 26 February 2018

Our documentation for the JavaScript API includes many examples of self-contained common use cases. To enhance the developer experience, we display the supportive code with each example, as shown below.

Supportive code for JavaScript API example

While this is helpful for when a glance at the code is all that is needed, what about experimenting with the code itself? Sure, you can copy-and-paste from the screen, but there is a more elegant approach. We are happy to announce GitHub and JSFiddle support and integration for all the JavaScript API examples provided in our documentation. This allows sharing the entire example quickly into a development environment of your choice with a click of a button.

"Fork on GitHub" button, "Edit in JSFiddle" button

This post will briefly demonstrate how to use each new feature. Although previewing the code does not require a developer account at HERE, GitHub, or JSFiddle, it is strongly recommended to set up accounts at each - especially if you intend to edit and preserve your own code changes.

Edit in JSFiddle

As the name implies, JSFiddle is on online resource that allows developers to quickly fiddle around with JavaScript and related web stack technologies. If you click on the "Edit in JSFiddle" button, a new browser tab/instance opens with all the example code. In the screen capture below, the "Map at a specific location" example is instantly loaded and ready to edit and execute.

"Map at a specified location" example code within JSFiddle editor


Fork on GitHub

You can also choose to fork the example from the HERE GitHub repository. When clicking on the "Fork on GitHub" button, a new browser tab/instance opens revealing the self-contained example in folder structure as seen here.

"Map at a specified location" example shown in GitHub

Once you are at any of the examples in GitHub, you are one link away from viewing all the JavaScript API examples in the repository.

HERE JavaScript examples at GitHub


We hope you enjoy these new features and welcome your feedback. Happy coding!