Creating a dedicated package for iframe API typings
If users are willing to use Typescript to develop scripts for maps, they will need typings for the `WA` object. This commit creates a new package (@workadventure/iframe-api-typings) that contains only the `iframe_api.d.ts` file. The file is generated from the build of the front and isolated in this package. This is necessary because the iframe_api.js file is supposed to always be loaded from WorkAdventure directly (and there is no @workadventure/iframe-api package and there will never be one)
This commit is contained in:
parent
a1f06ffbd5
commit
6acf0ff047
6 changed files with 98 additions and 0 deletions
1
front/packages/iframe-api-typings/.gitignore
vendored
Normal file
1
front/packages/iframe-api-typings/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
iframe_api.d.ts
|
27
front/packages/iframe-api-typings/README.md
Normal file
27
front/packages/iframe-api-typings/README.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
<h1 align="center">WorkAdventure - IFrame API typings for Typescript</h1>
|
||||
|
||||
<p align="center">This package contains Typescript typings for <a href="https://workadventu.re/map-building/scripting">WorkAdventure's map scripting API</a></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
[WorkAdventure](https://workadventu.re) comes with a scripting API. Using this API, you can add some intelligence to your map.
|
||||
You use this API by loading an external script directly from WorkAdventure (at https://play.workadventu.re/iframe_api.js), or this script is loaded
|
||||
for you if you are using the "script" property of a map.
|
||||
|
||||
This project contains Typescript typings for the `WA` object provided by this script.
|
||||
|
||||
## Usage
|
||||
|
||||
This package is only useful if you are using Typescript to script your WorkAdventure maps.
|
||||
|
||||
## Download & Installation
|
||||
|
||||
```shell
|
||||
$ npm install @workadventure/iframe-api-typings
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```shell
|
||||
$ yarn add @workadventure/iframe-api-typings
|
||||
```
|
1
front/packages/iframe-api-typings/iframe_api.js
Normal file
1
front/packages/iframe-api-typings/iframe_api.js
Normal file
|
@ -0,0 +1 @@
|
|||
// This file is voluntarily empty.
|
13
front/packages/iframe-api-typings/package.json
Normal file
13
front/packages/iframe-api-typings/package.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "@workadventure/iframe-api-typings",
|
||||
"version": "1.2.0",
|
||||
"description": "Typescript typings for WorkAdventure iFrame API",
|
||||
"main": "iframe_api.js",
|
||||
"types": "iframe_api.d.ts",
|
||||
"repository": "https://github.com/thecodingmachine/workadventure/",
|
||||
"author": "David Négrier <d.negrier@thecodingmachine.com>",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue