@yandex/ymaps3-default-ui-theme package
Yandex JS API package
How use
The package is located in the dist
folder:
dist/types
TypeScript typesdist/esm
es6 modules for direct connection in your projectdist/index.js
Yandex JS Module
Recommended use YMapButtonExample
as usual npm package:
npm i @yandex/ymaps3-default-ui-theme
and dynamic import
await ymaps3.ready;
const {YMapButtonExample} = await import('@yandex/ymaps3-default-ui-theme');
map.addChild(new YMapButtonExample(props));
Usage without npm
You can use CDN with module loading handler in JS API on your page.
Just use ymaps3.import
:
const pkg = await ymaps3.import('@yandex/ymaps3-default-ui-theme');
By default ymaps3.import
can load self modules.
If you want also load your package, should add loader
:
ymaps3.import.loaders.unshift(async (pkg) => {
if (!pkg.includes('@yandex/ymaps3-default-ui-theme')) return;
await ymaps3.import.script(`https://unpkg.com/${pkg}/dist/index.js`);
return window['@yandex/ymaps3-default-ui-theme'];
});