bkjxxxw/WebContent/static/echarts-2.2.7/doc/asset/js/esl/js.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-03-18 10:04:33 +08:00
/**
* ESL (Enterprise Standard Loader)
* Copyright 2013 Baidu Inc. All rights reserved.
*
* @file JS Loader-Plugin
* @author errorrik(errorrik@gmail.com)
*/
// 构建环境暂不支持分析为了能合并该plugin到loader里
// 只能暂时使用具名id
define( 'js', {
load: function ( resourceId, req, load, config ) {
function onload() {
var readyState = script.readyState;
if (
typeof readyState == 'undefined'
|| /^(loaded|complete)$/.test( readyState )
) {
script.onload = script.onreadystatechange = null;
script = null;
load( true );
}
}
var script = document.createElement( 'script' );
script.src = req.toUrl( resourceId );
script.async = true;
if ( script.readyState ) {
script.onreadystatechange = onload;
}
else {
script.onload = onload;
}
var parent = document.getElementsByTagName( 'head' )[ 0 ]
|| document.body;
parent.appendChild( script ) && ( parent = null );
}
} );