quadtree-ts

2.2.2

Setup Example

JS development is constantly evolving. This library ships three different versions to offer a high range of support.

ES6 / Common JS

npm install --save @timohausmann/quadtree-ts
npm install --save-dev @timohausmann/quadtree-ts
yarn add @timohausmann/quadtree-ts

For ES6 modules and CommonJS, all classes are available as named exports.

ES6

import { Quadtree, Rectangle, Circle, Line } from '@timohausmann/quadtree-ts';

CommonJS

const { Quadtree, Rectangle, Circle, Line } = require('@timohausmann/quadtree-ts');

Script Tag

If you simply want to load the library with a script tag, use the UMD version.

All primitive classes are available under the Quadtree. namespace.

To be beginner friendly, all examples use this UMD syntax. Just remove all Quadtree. if you use ES6 / CJS.

UMD Full

<script src="quadtree.umd.full.js"></script>
<script>
    console.log(Quadtree, Quadtree.Rectangle, Quadtree.Circle, Quadtree.Line);
</script>

If you are a minimalist, the basic version only includes the Quadtree and Rectangle class.

UMD Basic

<script src="quadtree.umd.basic.js"></script>
<script>
    console.log(Quadtree, Quadtree.Rectangle);
</script>