# Core API

## Installation

Once you've downloaded Planetary.js, you can include it via a `script` tag on your page after the inclusion of D3 and TopoJSON. This example uses the CDN URLs for those libraries:

HTML

    <html>
    <head>
      <script type='text/javascript' src='http://d3js.org/d3.v3.min.js'></script>
      <script type='text/javascript' src='http://d3js.org/topojson.v1.min.js'></script>
      <script type='text/javascript' src='path/to/planetaryjs.min.js'></script>
    </head>
    <body>
    ...

If you use the default `topojson` plugin (most people will), you'll also need to make sure `world-110m.json` (or some other TopoJSON data file) is available on your server. This file is also available from the download page. See the TopoJSON Plugin documentation for more information.

## Core API

`planetaryjs.noConflict()`

In non-AMD and non-CommonJS environments, Planetary.js takes over the global `planetaryjs` namespace (in the browser, this means `window.planetaryjs`). If, for some reason, something else useful was there before you loaded Planetary.js, you can ask for it to be returned to that spot by calling `planetaryjs.noConflict()`. The Planetary.js library will be returned from the function, so you can continue to use the library.

JavaScript

    var planetary = planetaryjs.noConflict();

`planetaryjs.loadPlugin(plugin)`

Planetary.js uses a plugin architecture for all its functionality. Calling `planetaryjs.loadPlugin` will cause that plugin to be loaded in all planets created from this library. If you only want to use a plugin in some of your planets, use the `planet.loadPlugin` method (from the Planet API) instead.

JavaScript

    planetaryjs.loadPlugin(somePlugin);
    planetaryjs.loadPlugin(somePluginGenerator());

For more information on the plugin system and API, please see the Plugins documentation.

`planetaryjs.planet()`

The `planet` API call returns a new planet instance, which represents a single globe. It will be created with all the plugins registered with `planetaryjs.loadPlugin` active. It has various methods for manipulating the globe and drawing it to a canvas. The Planet API covers these methods in considerably more detail.

JavaScript

    var planet = planetaryjs.planet();