npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jibestream-dev/jmap-zone-kit

v1.0.4

Published

Kit for the Jibestream SDK to utilize Zones plotted in the CMS

Downloads

78

Readme

Classes

Zone

Kind: global class

new Zone()

Class representing a Zone

zone.name : String

Kind: instance property of Zone

zone.description : String

Kind: instance property of Zone

zone.color : String

Kind: instance property of Zone

ZoneCollection ⇐ jmap.core.BaseCollection

Class representing a collection of Devices.

Kind: global class
Extends: jmap.core.BaseCollection

new ZoneCollection()

Create a collection of Devices.

zoneCollection.isZone(item) ⇒ Boolean

Returns a boolean for whather or not argument is constructed as an Device object

Kind: instance method of ZoneCollection
Returns: Boolean - Boolean based on evaluation result

| Param | Type | Description | | --- | --- | --- | | item | Object | Item to evaluate |

zoneCollection.getByName(name) ⇒ Array.<Zone>

  • Returns Zone/s by their name (or returns an empty array)

Kind: instance method of ZoneCollection
Returns: Array.<Zone> - - The desired Zone/s (or an empty array if name is invalid)
Access: public

| Param | Type | Description | | --- | --- | --- | | name | string | The name of the desired Zone/s |

Example

const name = 'Food Court'
const zone = e(name)

zoneCollection.getByWaypoint(waypoint) ⇒ Array.<Zone>

  • Returns Zone/s by a given waypoint (or returns an empty array)

Kind: instance method of ZoneCollection
Returns: Array.<Zone> - - The desired Zone/s (or an empty array if waypoint is invalid)
Access: public

| Param | Type | Description | | --- | --- | --- | | waypoint | Waypoint | The waypoint to search with |

Example

const waypoint = control.currentMap.waypoints[0]
const zone = getByWaypoint(waypoint)

zoneCollection.getByMap(map) ⇒ Array.<Zone>

  • Returns Zone/s by a given map (or returns an empty array)

Kind: instance method of ZoneCollection
Returns: Array.<Zone> - - The desired Zone/s (or an empty array if map is invalid)
Access: public

| Param | Type | Description | | --- | --- | --- | | map | Map | The map on which we're searching |

Example

const map = control.currentMap
const zone = getByMap(map)

ZoneKit

Kit for working with Jibestream Zones

Kind: global class

new ZoneKit(core, control)

Create a ZoneKit.

| Param | Type | Description | | --- | --- | --- | | core | jmap.core | instantiated JCore | | control | jmap.JController | instantiated JController |

zoneKit.getWaypointsInZone(zone) ⇒ Array.<jmap.core.Waypoint>

  • Returns all waypoints associated with a given Zone (or returns an empty array)

Kind: instance method of ZoneKit
Returns: Array.<jmap.core.Waypoint> - - The waypoints associated with a given zone (or an empty array)
Access: public

| Param | Type | Description | | --- | --- | --- | | zone | Zone | The Zone we're using to search for waypoints |

Example

const zone = zoneKit.zones.getAll()[0]
const waypoints = zoneKit.getWaypointsInZone(zone)

zoneKit.getDestinationsInZone(zone) ⇒ Array.<jmap.core.Destination>

  • Returns all destinations associated with waypoints within an zone (or returns an empty array)

Kind: instance method of ZoneKit
Returns: Array.<jmap.core.Destination> - - The destinations associated with a given zone (or an empty array)
Access: public

| Param | Type | Description | | --- | --- | --- | | zone | Zone | The Zone we're using to search for destinations |

Example

const zone = zoneKit.zones.getAll()[0]
const destinations = zoneKit.getDestinationsInZone(zone)

zoneKit.getAmenitiesInZone(zone) ⇒ Array.<jmap.core.Amentity>

  • Returns all amenity instances associated with waypoints within an zone (or returns an empty array)

Kind: instance method of ZoneKit
Returns: Array.<jmap.core.Amentity> - - The amenities associated with a given zone (or an empty array)
Access: public

| Param | Type | Description | | --- | --- | --- | | zone | Zone | The Zone we're using to search for destinations |

Example

const zone = zoneKit.zones.getAll()[0]
const amentities = zoneKit.getAmenitiesInZone(zone)

zoneKit.getBoundsOfZoneOnMap(zone, map) ⇒ jmap.Bounds

  • For a given Zone, return the bounding box for the associated waypoints on the specified map If an invalid zone or map is given, null is returned

Kind: instance method of ZoneKit
Returns: jmap.Bounds - - A Bounds object
Access: public

| Param | Type | Description | | --- | --- | --- | | zone | Zone | The Zone we're using to calculate bounding boxes | | map | jmap.core.Map | The map we'll use to calculate the bounding box |

Example

const zone = zoneKit.zones.getAll()[0]
const map = control.currentMap
const bounds = zoneKit.getBoundsOfZone(zone, map)

zoneKit.getPolygonOfZoneOnMap(zone, map) ⇒ jmap.jungle.shape.Polygon

  • Returns a polygon shape, based on the waypoints associated with the specified zone on the specified map. The zone must have three or more waypoints associated with it on the given map, otherwise null will be returned

Kind: instance method of ZoneKit
Returns: jmap.jungle.shape.Polygon - - A Polygon object
Access: public

| Param | Type | Description | | --- | --- | --- | | zone | Zone | The Zone we're using to calculate polygons | | map | jmap.core.Map | The map we'll use to calculate the polygon |

Example

const zone = zoneKit.zones.getAll()[0]
const map = control.currentMap
const polygon = zoneKit.getPolygonOfZone(zone, map)

zoneKit.drawPolygonOfZoneOnMap(zone, map, style) ⇒ Polygon

  • Given a specific Zone, draw a polygon the encompasses all of its waypoints on the specified map

Kind: instance method of ZoneKit
Returns: Polygon - - The polygon that was drawn
Access: public

| Param | Type | Description | | --- | --- | --- | | zone | Zone | The Zone we wish to highlight using a polygon | | map | jmap.core.Map | The map we wish to draw the polygon on | | style | jmap.Style | The way in which the polygon should be styled. Default style uses zone.color |

Example

const zone = zoneKit.zones.getAll()[0]
const map = control.currentMap
const polygon = zoneKit.drawPolygonOfZone(zone, map)

zoneKit.getZones([cb]) ⇒ ZoneKit

  • Returns all zones for the currently loaded building

Kind: instance method of ZoneKit
Returns: ZoneKit - - The current ZoneKit instance
Access: public

| Param | Type | Description | | --- | --- | --- | | [cb] | function | The callback function, which will run once the Zones have been retrieved. The Zones will be stored in this.zones |

Example

const fn = (error, zones) => console.log(zones)
zoneKit.getZones(fn)

zoneKit.getCentroidOfZoneOnMap(zone, map) ⇒ Array.<Number>

  • Return the coordinates of the centroid of a given zone on the given map The zone must have three or more waypoints associated with it on the given map otherwise null will be returned

Kind: instance method of ZoneKit
Returns: Array.<Number> - - The centroid in the form of [x, y]
Access: public

| Param | Type | Description | | --- | --- | --- | | zone | Zone | The zone we wish to find the centroid of | | map | jmap.core.Map | The map on which we'll use to find the centroid |

Example

const zone = zoneKit.zones.getAll()[0]
const map = control.currentMap
const centroid = zoneKit.getCentroidOfZone(zone, map)

zoneKit.getClosestWaypointInZoneToPoint(zone, jMapPoint, [searchType]) ⇒ jmap.core.Waypoint

  • Given a specific point on the a map, return the closest waypoint associated with the given Zone

Kind: instance method of ZoneKit
Returns: jmap.core.Waypoint - - The closest waypoint within the specified Zone to the provided point
Access: public

| Param | Type | Default | Description | | --- | --- | --- | --- | | zone | Zone | | The zone we wish to search within | | jMapPoint | jMapPoint | | The point we wish to search with | | [searchType] | String | 'proximity' | Either 'proximity' or 'grid' |

Example

const jMapPoint = { x: 2750, y: 2750, mapId: control.currentMap.id }
const zone = zoneKit.zones.getAll()[0]
const waypoint = zoneKit.getClosestWaypointInZoneToPoint(zone, jMapPoint)

zoneKit.highlightUnitsInZone(zone, style) ⇒ ZoneKit

  • Highlight all units associated to a specific zone using either the color specified in the CMS or the color override provided

Kind: instance method of ZoneKit
Returns: ZoneKit - - The current ZoneKit instance
Access: public

| Param | Type | Description | | --- | --- | --- | | zone | Zone | The zone we wish to highlight | | style | jmap.Style | The way in which the unit will be styled |

Example

const zone = zoneKit.zones.getAll()[0]
const style = new jmap.Style({ fill: '#4a85e2' })
zoneKit.highlightUnitsInZone(zone, style)

zoneKit.watchMovingObjects(zonesExitedCallback, zonesEnteredCallback) ⇒ ZoneKit

  • Subscribe to animation complete callback for moving objects and send back zones exited/entered

Kind: instance method of ZoneKit
Returns: ZoneKit - - The current ZoneKit instance
Access: public

| Param | Type | Description | | --- | --- | --- | | zonesExitedCallback | function | Callback for zones being exited | | zonesEnteredCallback | function | Callback for zones being entered |

Example

function watchMovingObjCallback(zones) {
}
zoneKit.watchMovingObjects(watchMovingObjCallback, watchMovingObjCallback)

zoneKit.unwatchMovingObjects() ⇒ ZoneKit

  • Unsubscribe to animation complete callback for moving objects

Kind: instance method of ZoneKit
Returns: ZoneKit - - The current ZoneKit instance
Access: public
Example

zonKit.unwatchMovingObjects()