Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[jsfm] Fix the console API to adapt JSC on Android #470

Merged
merged 2 commits into from Jun 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions html5/shared/console.js
Expand Up @@ -38,10 +38,8 @@ export function setNativeConsole () {
generateLevelMap()

/* istanbul ignore next */
if (
typeof global.console === 'undefined' || // Android
(global.WXEnvironment && global.WXEnvironment.platform === 'iOS') // iOS
) {
// mock console in native environment
if (global.WXEnvironment && global.WXEnvironment.platform !== 'Web') {
global.console = {
debug: (...args) => {
if (checkLevel('debug')) { global.nativeLog(...format(args), '__DEBUG') }
Expand All @@ -60,7 +58,9 @@ export function setNativeConsole () {
}
}
}
else { // HTML5 or Node

// Web or Node
else {
const { debug, log, info, warn, error } = console
console.__ori__ = { debug, log, info, warn, error }
console.debug = (...args) => {
Expand Down