u
This commit is contained in:
parent
849bc8997b
commit
69257f2aa4
8
coco-none.js
Normal file
8
coco-none.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
cclog () { },
|
||||||
|
ccinfo () { },
|
||||||
|
ccgood () { },
|
||||||
|
ccwarn () { },
|
||||||
|
ccerror () { },
|
||||||
|
ccdebug () { }
|
||||||
|
}
|
12
coco.js
12
coco.js
@ -2,12 +2,14 @@
|
|||||||
// consola works in nodejs and browser
|
// consola works in nodejs and browser
|
||||||
// chalk 和 colors 用法类似。
|
// chalk 和 colors 用法类似。
|
||||||
|
|
||||||
// in uniapp: globalThis.uni && globalThis.UniApp
|
// globalThis.uni // 在 web/app 里都为对象
|
||||||
// in vue: globalThis.getApp?.()?.constructor?.name === 'Vue'
|
// globalThis.UniApp // 在 web 里返回一个函数,在 app 里返回 undefined
|
||||||
|
// globalThis.getApp?.()?.constructor?.name === 'Vue' // 在 web 里 true, 在 app 里 false
|
||||||
|
// typeof(globalThis.getApp)==='function' // 在 web/app 里都为 true
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
process?.release?.name === 'node' ? require('./coco-nodejs.js')
|
process?.release?.name === 'node' ? require('./coco-nodejs.js')
|
||||||
: globalThis.window && globalThis.location ? require('./coco-browser.js')
|
|
||||||
: globalThis.uniCloud ? require('./coco-unicloud.js')
|
: globalThis.uniCloud ? require('./coco-unicloud.js')
|
||||||
: require('./coco-app.js')
|
: globalThis.window && globalThis.location ? require('./coco-browser.js')
|
||||||
|
: globalThis.uni && globalThis.getApp ? require('./coco-app.js')
|
||||||
|
: require('./coco-none.js')
|
||||||
|
Loading…
Reference in New Issue
Block a user