本文整理汇总了TypeScript中@src/lib/logging.Logger.debug方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Logger.debug方法的具体用法?TypeScript Logger.debug怎么用?TypeScript Logger.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@src/lib/logging.Logger
的用法示例。
在下文中一共展示了Logger.debug方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: create
export async function create(
name: string,
color = "random",
icon = "fingerprint",
): Promise<string> {
if (color === "random") color = chooseRandomColor()
const container = fromString(name, color, icon)
// browser.contextualIdentities.create does not accept a cookieStoreId property.
delete container.cookieStoreId
logger.debug(container)
if (await exists(name)) {
logger.debug(`[Container.create] container already exists ${container}`)
throw new Error(
`[Container.create] container already exists, aborting.`,
)
} else {
const res = await browser.contextualIdentities.create(container)
return res.cookieStoreId
}
}
示例2: addContentStateChangedListener
addContentStateChangedListener((property, oldMode, oldValue, newValue) => {
let mode = newValue
let suffix = ""
let result = ""
if (property !== "mode") {
if (property === "suffix") {
mode = oldMode
suffix = newValue
} else {
return
}
}
const privateMode = browser.extension.inIncognitoContext
? "TridactylPrivate"
: ""
statusIndicator.className =
"cleanslate TridactylStatusIndicator " + privateMode
if (
dom.isTextEditable(document.activeElement) &&
!["input", "ignore"].includes(mode)
) {
statusIndicator.textContent = "insert"
// this doesn't work; statusIndicator.style is full of empty string
// statusIndicator.style.borderColor = "green !important"
// need to fix loss of focus by click: doesn't do anything here.
} else if (
mode === "insert" &&
!dom.isTextEditable(document.activeElement)
) {
statusIndicator.textContent = "normal"
// statusIndicator.style.borderColor = "lightgray !important"
} else {
result = mode
}
const modeindicatorshowkeys = Config.get("modeindicatorshowkeys")
if (modeindicatorshowkeys === "true" && suffix !== "") {
result = mode + " " + suffix
}
logger.debug(
"statusindicator: ",
result,
";",
"config",
modeindicatorshowkeys,
)
statusIndicator.textContent = result
statusIndicator.className +=
" TridactylMode" + statusIndicator.textContent
if (config.get("modeindicator") !== "true") statusIndicator.remove()
})
示例3: update
export async function update(
containerId: string,
updateObj: {
name: string
color: browser.contextualIdentities.IdentityColor
icon: browser.contextualIdentities.IdentityIcon
},
) {
if (isValidColor(updateObj.color) && isValidIcon(updateObj.icon)) {
browser.contextualIdentities.update(containerId, updateObj)
} else {
logger.debug(updateObj)
throw new Error("[Container.update] invalid container icon or color")
}
}
示例4: updateVersion
async function updateVersion() {
try {
// If any monster any makes a novelty tag this will break.
// So let's just ignore any errors.
const parser = new RssParser()
const feed = await parser.parseURL("https://github.com/tridactyl/tridactyl/tags.atom")
const mostRecent = feed.items[0]
// Update our last update check timestamp and the version itself.
Config.set("update", "lastchecktime", Date.now())
highestKnownVersion = {
version: mostRecent.title,
releaseDate: new Date(mostRecent.pubDate), // e.g. 2018-12-04T15:24:43.000Z
}
logger.debug("Checked for new version of Tridactyl, found ", highestKnownVersion)
} catch (e) {
logger.error("Error while checking for updates: ", e)
}
}
示例5: remove
export async function remove(name: string) {
logger.debug(name)
const id = await getId(name)
const res = await browser.contextualIdentities.remove(id)
logger.debug("[Container.remove] removed container:", res.cookieStoreId)
}
示例7: Error
if ((window as any).tridactyl_content_lock !== undefined) {
throw Error("Trying to load Tridactyl, but it's already loaded.")
}
(window as any).tridactyl_content_lock = "locked"
// Be careful: typescript elides imports that appear not to be used if they're
// assigned to a name. If you want an import just for its side effects, make
// sure you import it like this:
import "@src/lib/html-tagged-template"
/* import "@src/content/commandline_content" */
/* import "@src/excmds_content" */
/* import "@src/content/hinting" */
import * as Config from "@src/lib/config"
import * as Logging from "@src/lib/logging"
const logger = new Logging.Logger("content")
logger.debug("Tridactyl content script loaded, boss!")
// Our local state
import {
contentState,
addContentStateChangedListener,
} from "@src/content/state_content"
// Set up our controller to execute content-mode excmds. All code
// running from this entry point, which is to say, everything in the
// content script, will use the excmds that we give to the module
// here.
import * as controller from "@src/lib/controller"
import * as excmds_content from "@src/.excmds_content.generated"
import { CmdlineCmds } from "@src/content/commandline_cmds"
import { EditorCmds } from "@src/content/editor"