Wrapper for asynchronously used async-loader-js API in browser.
This module does not change original a maps api in any way. It just provide easy way to load and use this API asynchronously.
Environment with common js:
$ npm install async-loader-js
Download and import one of these files into your .html file:
var AsyncLoader = require('async-loader-js'); // only for common js environments
AsyncLoader.load(function(al) {
//TODO:al is js object
});
If you are not using environment with common js support, you can use AsyncLoader
variable directly. It is
already in window
object.
AsyncLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm';
AsyncLoader.CLIENT = 'yourclientkey';
AsyncLoader.VERSION = '1.0';
AsyncLoader.LIBRARIES = [];
AsyncLoader.LANGUAGE = 'zh-CN';
AsyncLoader.REGION = 'GB';
For testing purposes is good to remove all async-loader-js objects and restore loader to its original state.
AsyncLoader.release(function() {
console.log('No async-loader-js api around');
});
AsyncLoader.onLoad(function(ol) {
console.log('I just loaded js');
});
- 1.0.0
- Initial version