Skip to content

Instantly share code, notes, and snippets.

View cheng-kang's full-sized avatar
🐢
Don't know how to drive.

Kang Cheng · 程康 cheng-kang

🐢
Don't know how to drive.
View GitHub Profile
@cheng-kang
cheng-kang / load-js-sequentially.js
Created November 16, 2017 21:11
This script helps you to dynamically load a list of JS files sequentially to your webpage.
/**
* Dynamically load a list JS files sequentially.
*
* @param {(string|Object)[]} aList The list of JS files to load
* @param {string} aList[].url The url of the JS file to load
* @param {function} aList[].loaded Callback when the file is loaded
* @param {function} aList[].shouldSkip Check before loading the file.
* Note: if `loaded` is set, it will be called no matter this loading is skiped or not.
* Skipping loading means only to skip the loading part.
*
@cheng-kang
cheng-kang / load-js.js
Last active November 16, 2017 21:11
This script helps you to dynamically load a JS file to your webpage.
/**
* Dynamically load a JS file.
*
* @param {string|Object} item
* @param {string} item.url The url of the JS file to load
* @param {function} item.loaded Callback function when the file is loaded
* @param {function} item.shouldSkip Check before loading the file.
* Note: if `loaded` is set, it will be called no matter this loading is skiped or not.
* Skipping loading means only to skip the loading part.
*
<div class="wildfire_thread"></div>
<script type="text/javascript">
const wildfireConfig = () => ({
databaseProvider: 'wilddog',
databaseConfig: {
siteId: 'wd2168973289ifdmcg'
},
pageURL: 'http://chengkang.me/wildfire',
pageTitle: 'Wildfire Home Page',
theme: 'light',