Skip to content

Commit 5ba1775

Browse files
committed
initial commit
0 parents  commit 5ba1775

File tree

12 files changed

+211
-0
lines changed

12 files changed

+211
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.DS_Store
3+
.npmrc
4+
*.log
5+
coverage
6+
package-lock.json

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 100
5+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Waseem Dahman
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NOTICE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MapKit and the Apple logo are trademarks of Apple Inc., registered in the U.S. and other countries.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# mapkit-typescript
2+
3+
TypeScript type definitions for [MapKit JS](https://developer.apple.com/documentation/mapkitjs).
4+
5+
## Installation
6+
7+
```sh
8+
# using npm
9+
npm install --save-dev mapkit-typescript
10+
11+
# using yarn
12+
yarn add --dev mapkit-typescript
13+
```
14+
15+
## Legal
16+
17+
MapKit and the Apple logo are trademarks of Apple Inc., registered in the U.S. and other countries.

index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Type definitions for MapKit JS 5.0
2+
// Project: https://developer.apple.com/documentation/mapkitjs
3+
// Definitions by: Waseem Dahman <https://github.com/wsmd>
4+
5+
/// <reference path="./mapkit.d.ts" />

mapkit.d.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Type definitions for MapKit JS 5.0
2+
// Project: https://developer.apple.com/documentation/mapkitjs
3+
// Definitions by: Waseem Dahman <https://github.com/wsmd>
4+
5+
/**
6+
* The JavaScript API for embedding Apple maps on your website.
7+
*/
8+
declare namespace mapkit {
9+
/**
10+
* Initialize a mapkit object by providing an authorization callback and language.
11+
*/
12+
function init(options: MapKitInitOptions): void;
13+
/**
14+
* Subscribes a listener function to an event type.
15+
*
16+
* @param type The type of event (e.g., "configuration-change").
17+
* @param listener The callback function to invoke. listener is passed an
18+
* Event as its sole argument.
19+
* @param thisObject An object set as the this keyword on the listener function.
20+
*/
21+
function addEventListener(
22+
type: InitializationEventType,
23+
listener: (event: InitializationEvent) => void,
24+
thisObject?: any,
25+
): void;
26+
/**
27+
* Unsubscribes a listener function from an event type.
28+
*
29+
* @param type The type of event (e.g., "configuration-change").
30+
* @param listener The callback function to remove.
31+
* @param thisObject An object set as the this keyword on the listener function.
32+
*/
33+
function removeEventListener(
34+
type: InitializationEventType,
35+
listener: (event: InitializationEvent) => void,
36+
thisObject?: any,
37+
): void;
38+
/**
39+
* A language ID indicating the selected language.
40+
*/
41+
let language: string;
42+
/**
43+
* The build string.
44+
*/
45+
const build: string;
46+
/**
47+
* The version of MapKit JS.
48+
*/
49+
const version: string;
50+
51+
/**
52+
* Initialization options for MapKit JS.
53+
*/
54+
interface MapKitInitOptions {
55+
/**
56+
* A callback function that obtains a token.
57+
*
58+
* @param done A function that completes the MapKit JS token request. Called
59+
* after creating a new token.
60+
*/
61+
authorizationCallback: (done: (token: string) => void) => void;
62+
/**
63+
* An ID that indicates the preferred language in which to display map
64+
* labels, controls, directions, and other text.
65+
*/
66+
language?: string;
67+
}
68+
69+
type InitializationEventType = 'configuration-change' | 'error';
70+
71+
interface InitializationEvent {
72+
status: 'Initialized' | 'Refreshed' | 'Unauthorized' | 'Too Many Requests';
73+
}
74+
}

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "mapkit-typescript",
3+
"version": "0.1.0",
4+
"description": "Typescript type definitions for MapKit JS",
5+
"repository": "wsmd/mapkit-typescript",
6+
"types": "./index.d.ts",
7+
"bugs": {
8+
"url": "https://github.com/wsmd/mapkit-typescript/issues"
9+
},
10+
"scripts": {
11+
"test": "tsc",
12+
"touch": "./scripts/create-file"
13+
},
14+
"author": "Waseem Dahman <dwaseem@icloud.com>",
15+
"license": "MIT",
16+
"keywords": [
17+
"Apple",
18+
"MapKit.d.ts",
19+
"MapKit",
20+
"types",
21+
"typescript",
22+
"typings"
23+
],
24+
"devDependencies": {
25+
"typescript": "^3.2.2"
26+
}
27+
}

scripts/create-file

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
file="mapkit.$1.d.ts"
4+
index="index.d.ts"
5+
6+
touch $file
7+
8+
cat <<EOT >> $file
9+
// Type definitions for MapKit JS 5.0
10+
// Project: https://developer.apple.com/documentation/mapkitjs
11+
// Definitions by: Waseem Dahman <https://github.com/wsmd>
12+
13+
declare namespace mapkit {
14+
class $1 {}
15+
}
16+
EOT
17+
18+
echo "/// <reference path=\"./$file\" />" >> $index
19+
20+
echo "Created $file"

0 commit comments

Comments
 (0)