add()

in src/plugin/registry.ts [37:53]


  add(placeId: PlaceId, plugin: PluginInterface) {
    if (!window.TEAMCITY_PLUGINS.store[placeId]) {
      window.TEAMCITY_PLUGINS.store[placeId] = []
    }

    const place = window.TEAMCITY_PLUGINS.store[placeId]

    if (Array.isArray(place)) {
      if (place.some(item => item.name === plugin.name)) {
        throw Error(`Plugin ${plugin.name} has been already registered in PlaceId ${placeId}. `)
      }

      window.TEAMCITY_PLUGINS.store[placeId] = place.concat(plugin)
    }

    window.TEAMCITY_PLUGINS.handlers.forEach(hander => hander())
  }