JSBOX-UTIL by theajack
js,
jsboxcdngithub
js
window.jsboxCode = ``; // javascript
json
window.jsboxCode = {
lib: '', // cdn jsbox, name
code: ``,
lang: 'javascript', // javascript javascript, html, ... jsbox lang type
theme: 'dark', // dark darklight
wrapCode: true, // jsfalse
needUI: true, // ui false
useDefaultUI: true, // ui false
hideLog: false, // log false
clearWhenReRun: false, // html false lang=html
}
JsBox list
['jquery', 'vue', 'react', 'react-dom', 'angularjs', 'vuex', 'redux', 'loadsh', 'virtual-dom', 'node-html-parser', 'jest', 'mocha', 'moment', 'dayjs', 'underscore', 'axios', 'qrcode', 'backbone', 'js-xlsx', 'recast', 'cnchar', 'cnchar-poly', 'cnchar-order', 'cnchar-trad', 'cnchar-draw', 'cnchar-idiom', 'cnchar-xhy', 'cnchar-radical', 'cnchar-all', 'easy-icon', 'element-ui', 'element-ui-style']
github jsbox.code.js
url https://shiyix.cn/jsbox?github=user.rep.file
user github
rep @xxx releasebranchcommit releasemaster
file jsbox.code.js
https://shiyix.cn/jsbox?github=theajack.pure-v
https://shiyix.cn/jsbox?github=theajack.pure-v@master
https://shiyix.cn/jsbox?github=theajack.pure-v.helper/custom.code.js
js code http http://xxx.com/config.js
https://shiyix.cn/jsbox?codeSrc=${decodeURIComponent('http://xxx.com/config.js')}
html
configjswindowjson
window.jsbox_config = {
libs: {
'loadsh': 'xxx', //
'jquery': {
url: 'xxx', //
type: 'script', // jscssurl
version: 'xxx', //
},
'cnchar': 'jsbox.cnchar', // jsboxjsbox.xxx
},
codes: { //
'helloWorld': 'console.log("Hello world")', //
'testLoadsh': {
code: '_.cloneDeep({a:1})', //
dep: ['loadsh', 'jsbox.cnchar'], // libs, jsboxjsbox.xxx
},
}
}
https://shiyix.cn/jsbox?config={url}&id=helloWorld}
github config jsbox.config.js 0.1.1
https://shiyix.cn/jsbox?githubConfig={user}.{rep}
https://shiyix.cn/jsbox?githubConfig={user}.{rep}.{file}
JSBox jsjs
npm install jsbox-util
import JSBox from 'jsbox-util';
<script src="https://cdn.jsdelivr.net/npm/jsbox-util/jsbox.min.js"></script>
// ,
JSBox.config({
theme?: string;
code?: string;
lib?: Array<string>;
config?: string;
githubConfig?: string;
id?: string;
env?: string;
lang?: string;
run?: boolean;
mes?: boolean;
remind?: boolean;
codeSrc?: string;
github?: string;
})
JSBox.open(); // jsbox
JSBox.open({
... // JSBox
});
theme, lib, env, lang 3.3
......
config > env > lib
0.3
jsbox