@solidsilver/mapkitjs

An npm module for Apple's Mapkit JS that works with Vue
971
Install
npm install @solidsilver/mapkitjs
Latest Version:0.0.4
License:MIT
Last Updated:May 4, 2021
Links: GitHub  ·  npm
Maintainer: solidsilver

mapkitjs

An npm module for Apple's Mapkit JS for use with Vue. This implementation uses the latest version of Mapkit JS and places its contents inside of a types folder. Based on Harvey Conner's repo, but with extra types from mapkit-typescript.

NPM version

Installation

npm install @solidsilver/mapkitjs

Usage

import mapkit from "@solidsilver/mapkitjs";

To init MapKitJS:

mapkit.init({
      authorizationCallback: function(done: (jwt: string) => void) {
        // callback functionality goes here
        done(jwt);
      },
      language: "en"
    });

Then, create a new map for the component:

// As a getter:
get map_id(): string {
    return `map-${this._uid}`;
}
// Assuming your component has a map object:
this.map = new mapkit.Map(this.map_id);

See Apple's documentation on additional options on map creation.

From here, mapkit and this.map can be accessed and modified as documented.

Updating

In order to update, simply replace the contents of the types folder, submit an issue, or make a pull request to update to the latest version.

The latest contents are pulled from:

https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js

Related Packages

@mr-hope/vuepress-types

VuePress TypeScript helpers

22,182 2,536
vuepress-types

VuePress TypeScript helpers

8,406 82
vuepress-typings

VuePress TypeScript helpers

2,174 2,536
@mdit-vue/types

Shared types definition of mdit-vue

6,739,381 221
@intlayer/types

Retrieve Intlayer configurations and manage environment variables for both serve...

741,980 856

Version History

Version Released License
0.0.4 MIT
0.0.3 MIT
0.0.2 MIT