Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ymaps

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ymaps

Yandex Maps on-demand promise-based widget loader

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ymaps

npm version CircleCI

Yandex Maps on-demand promise-based widget loader.

  • Appends Yandex Maps API script to the document body.
  • Returns a promise which resolves as soon as the script has loaded and the API is ready.

This way the widget doesn’t load until it’s needed to decrease page load time.

View on CodeSandbox →

Quickstart

Install from the command line:

npm install ymaps

Use in your code to load the widget:

import ymaps from 'ymaps';

ymaps
  .load()
  .then(maps => {
    const map = new maps.Map('your-map-container', {
      center: [-8.369326, 115.166023],
      zoom: 7
    });
  })
  .catch(error => console.log('Failed to load Yandex Maps', error));

To use another language simply pass a valid src to ymaps.load

ymaps.load('https://api-maps.yandex.ru/2.1/?lang=en_US').then(maps => {
  /* ... */
});

The information about other options is available in the API docs. Please check out known issues to see not supported options.

Running the tests

npm test

Known issues

  • load parameter, except when it's set to package.full is causing an error "TypeError: s is not a constructor". To reproduce, try to pass "//api-maps.yandex.ru/2.1/?lang=en_US&load=Map" to ymaps.load in the example above. PR is welcome!

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

SemVer is used for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 20 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc