# # PluginInterface

Interface for custom plugins added to the map. This is a specification for implementers to model: it is not an exported method or class.

Developers can implement callback methods to customize the Mini Tokyo 3D map. In order to add plugins, the objects that implement this interface have to be set to the `Map` constructor option `plugins`.

Custom plugins must have a unique `id`, and must have the `name` and `iconStyle`. They may implement `onAdd`, `onRemove`, `onEnabled`, `onDisabled` and `onVisibilityChanged`.

## # Properties

### # `clockModes` (`Array`
(opens new window)`<``string`
(opens new window)`>`)

The plugin will be visible only in the clock modes specified here. `'realtime'` and `'playback'` are supported. If not specified, it will be always visible.

### # `enabled` (`boolean`
(opens new window))

If `false`, the plugin will be disabled when it is added to the map. If not specified, it will be enabled.

### # `iconStyle` (`Object`
(opens new window))

The inline style of the icon element that appears in the layer panel. All the style properties contained in the CSSStyleDeclaration
(opens new window) are supported.

### # `id` (`string`
(opens new window))

A unique plugin id.

### # `name` (`Object`
(opens new window))

The name of the plugin. The key of each property indicates the language code and its value indicates the name in that language. If the language used in a browser is not included in the properties, it falls back to English.

Name | Description
--- | ---
`name.en` | Name in English
`name.fr` | Name in French
`name.ja` | Name in Japanese
`name.ko` | Name in Korean
`name.ne` | Name in Nepali
`name.pt` | Name in Portuguese
`name.th` | Name in Thai
`name.zh-Hans` | Name in Simplified Chinese
`name.zh-Hant` | Name in Traditional Chinese

### # `searchModes` (`Array`
(opens new window)`<``string`
(opens new window)`>`)

The plugin will be visible only in the search modes specified here. `'none'`, `'edit'` and `'route'` are supported. If not specified, it will be visible when the search panel is not displayed.

### # `viewModes` (`Array`
(opens new window)`<``string`
(opens new window)`>`)

The plugin will be visible only in the view modes specified here. `'ground'` and `'underground'` are supported. If not specified, it will be always visible.

## # Instance Members

### # `onAdd(map)`

Optional method called when the plugin has been added to the Map. This gives the plugin a chance to initialize resources and register event listeners.

#### # Parameters

`map` (`Map`) The Mini Tokyo 3D Map this plugin was just added to.

### # `onDisabled()`

Optional method called when the plugin has been disabled by users. This gives the plugin a chance to clean up the display elements.

### # `onEnabled()`

Optional method called when the plugin has been enabled by users. This gives the plugin a chance to initialize the display elements.

### # `onRemove(map)`

Optional method called when the plugin has been removed from the Map. This gives the plugin a chance to clean up resources and event listeners.

#### # Parameters

`map` (`Map`) The Mini Tokyo 3D Map this plugin was just removed from.

### # `onVisibilityChanged(visible)`

Optional method called when the visibility of the plugin has been changed, such as when the display mode of the map is changed. This gives the plugin a chance to change the visibility of the display elements.

#### # Parameters

`visible` (`boolean`
(opens new window)) `true` indicates that the plugin is in the visible state.