esri-module-loader
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -9,5 +9,5 @@ 'use strict'; | ||
var _shortcut = require('./shortcut'); | ||
var _shortcuts = require('./shortcuts'); | ||
var shortcut = _interopRequireWildcard(_shortcut); | ||
var shortcuts = _interopRequireWildcard(_shortcuts); | ||
@@ -18,3 +18,3 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
loadModules: _loadModules.loadModules, | ||
shortcut: shortcut | ||
shortcuts: shortcuts | ||
}; |
@@ -14,5 +14,5 @@ 'use strict'; | ||
var _shortcut = require('./shortcut'); | ||
var _shortcuts = require('./shortcuts'); | ||
var shortcut = _interopRequireWildcard(_shortcut); | ||
var shortcuts = _interopRequireWildcard(_shortcuts); | ||
@@ -47,3 +47,3 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
if (typeof module === 'string') { | ||
var path = shortcut.get(module); | ||
var path = shortcuts.get(module); | ||
if (path) { | ||
@@ -50,0 +50,0 @@ return { name: module, path: path }; |
{ | ||
"name": "esri-module-loader", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "a helper to load esri modules", | ||
@@ -5,0 +5,0 @@ "main": "es5/index.js", |
@@ -24,5 +24,5 @@ ![npm](https://img.shields.io/npm/v/esri-module-loader.svg) | ||
1. path string like `'esri/map'` | ||
2. shortcut name like `'Map'` | ||
3. name path object like `{ name: 'Map', path: 'esri/map' }` | ||
1. a full module value is an object like `{ name: 'Map', path: 'esri/map' }` | ||
2. or it can be a path string like `'your/path/to/module'`, which will be converted into `{ name: 'module', path: 'your/path/to/module' }` | ||
3. and it also can be a module name defined in shortcuts, like `'Map'` | ||
@@ -42,4 +42,4 @@ | ||
const modules = [ | ||
'esri/Map', // use last word as the module name | ||
'Color', // by defined shortcut name | ||
'esri/Color', // use last word as the module name | ||
'Map', // by defined shortcut name | ||
{ name: 'Graphic', path: 'esri/graphic' } // or you can specify your module name | ||
@@ -54,4 +54,6 @@ ] | ||
# Using third party modules needs extra dojo config: | ||
# third party modules | ||
needs extra dojo config: | ||
```js | ||
@@ -64,13 +66,13 @@ loadModules( | ||
# shortcut | ||
# shortcuts | ||
You can add your shortcut: | ||
You can add your own shortcuts: | ||
```js | ||
import EsriModuleLoader from 'esri-module-loader' | ||
const { loadModules, shortcut } = EsriModuleLoader | ||
const { loadModules, shortcuts } = EsriModuleLoader | ||
shortcut.add('Map', 'esri/map') | ||
shortcut.add({ name: 'Map', path: 'esri/map' }) | ||
shortcut.add([{ name: 'Map', path: 'esri/map' }, { name: 'Color', path: 'esri/Color' }]) | ||
shortcuts.add('Map', 'esri/map') | ||
shortcuts.add({ name: 'Map', path: 'esri/map' }) | ||
shortcuts.add([{ name: 'Map', path: 'esri/map' }, { name: 'Color', path: 'esri/Color' }]) | ||
@@ -77,0 +79,0 @@ loadModules(['Map', 'Color']).then(({ Map, Color}) => { |
import { loadModules } from './load-modules' | ||
import * as shortcut from './shortcut' | ||
import * as shortcuts from './shortcuts' | ||
export default { | ||
loadModules, | ||
shortcut | ||
shortcuts | ||
} |
import esriLoader from 'esri-loader' | ||
import * as shortcut from './shortcut' | ||
import * as shortcuts from './shortcuts' | ||
@@ -25,3 +25,3 @@ /** | ||
if (typeof module === 'string') { | ||
const path = shortcut.get(module) | ||
const path = shortcuts.get(module) | ||
if (path) { | ||
@@ -28,0 +28,0 @@ return { name: module, path } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
29507
13
691
80
0