Skip to content
Snippets Groups Projects

feat(submaps): Plugins Submaps (MIN-226)

Merged mateusz-winiarczyk requested to merge MIN-226-plugins-submaps into development
1 unresolved thread

Implemented getModels and openMap methods for plugins.

Get Models

To get data about all available submaps, plugins can use the getModels method defined in window.minerva.map.data. This method returns array with data about all submaps.

Example of getModels usage:
window.minerva.map.data.getModels();

Open Map

To open map, plugins can use the openMap method defined in window.minerva.map. This method takes one argument: an object with an id property that indicates the map ID.

Example of openMap usage:
window.minerva.map.openMap({ id: 51 });

submaps-plugins

Edited by mateusz-winiarczyk

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
3 import { modelsDataSelector } from '@/redux/models/models.selectors';
4 import { store } from '@/redux/store';
5 import { PluginsEventBus } from '../pluginsEventBus';
6
7 export type OpenMapArgs = {
8 id: number;
9 };
10
11 export const openMap = ({ id }: OpenMapArgs): void => {
12 const { getState, dispatch } = store;
13 const models = modelsDataSelector(getState());
14 const openedMaps = mapOpenedMapsSelector(getState());
15 const mapToOpen = models.find(model => model.idObject === id);
16 const currentModelId = mapModelIdSelector(getState());
17
18 if (!mapToOpen) throw new Error('Map with provided id does not exist');
  • mateusz-winiarczyk added 13 commits

    added 13 commits

    Compare with previous version

  • added 1 commit

    • a18cc4e8 - docs(errors): extract error messages constants and create docs for error messages

    Compare with previous version

  • mentioned in commit 1bfc48af

  • Please register or sign in to reply
    Loading