简体   繁体   中英

How can I add my library to be loaded Dashcode parts

Dashcode loads a bunch of library listed in an array within part.js

(function() {
    var scripts = dashcodePartSupport['core'];

    scripts = scripts.concat(dashcodePartSupport['scripts']);

    for(var index in scripts) {
        var path = scripts[index];
        var scriptTag = '<script apple-no-regeneration="yes" type="text/javascript" src="' + path + '"></script>';

        document.write( scriptTag );
    }    
})();

I tried to edit that file to append my own lib, but the file is not editable. So how can I do ?

function loadCode(code) {
    var i, j = code.length, element;

    for(i=0;i<j;++i) {
        element = document.createElement('script');
        element.src = code[i];

        document.getElementsByTagName('head')[0].appendChild(element);
    }
}

You can use this function this way:

loadCode(['code1.js', 'code2.js', ...]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM