Skip to content

saner-qu/async-loader-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

async-loader-js

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.

Installation

Environment with common js:

$ npm install async-loader-js

Download and import one of these files into your .html file:

Usage

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.

Options

Own API key

AsyncLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm';

Business API client

AsyncLoader.CLIENT = 'yourclientkey';
AsyncLoader.VERSION = '1.0';

Libraries

AsyncLoader.LIBRARIES = [];

Localization

AsyncLoader.LANGUAGE = 'zh-CN';

Region

AsyncLoader.REGION = 'GB';

Unload async-loader-js api

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');
});

Events

onLoad

AsyncLoader.onLoad(function(ol) {
	console.log('I just loaded js');
});

Tests


Changelog list

  • 1.0.0
    • Initial version

About

异步加载js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published