1.0.9 • Published 6 years ago

popoload v1.0.9

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Script and Style file resource load tool

中文介绍

In some application scenarios, we need to customize the loading of certain Javascript plug-ins based on configuration, usually including plug-in dependency scripts and styles. Pooload can load plug-ins and their dependencies through configuration.

Install

npm i popoload

or

<script src="./js/popoload.min.js"></script>

Use

PL({
    config: {
        path: {
            bootcdn: 'https://cdn.bootcss.com/'
        }
    },
    libs: [
        'bootcdn:jquery/3.1.1/jquery.min.js',
        'bootcdn:leaflet/1.3.1/leaflet.js'
    ],
    styles: [
        'bootcdn:leaflet/1.3.1/leaflet.css'
    ],
    loaded: function() {
        if($ && L) {
            $(document.body).html('All resource loaded.');
        }
    }
});

Config Options

ParamsTypeNote
configObjectconfig path.
config.pathObjectkey-value, Key is a reference and value is the actual reference path.
libsArrayDepending on the library script list, the value is key + ":" + dependency library file defined in config.path.
stylesArrayDepending on the library script list, the value is key + ":" + dependency library file defined in config.path.
loadedFunctionLoad completion callback method
1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago