當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Logger.debug方法代碼示例

本文整理匯總了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
    }
}
開發者ID:antonva,項目名稱:tridactyl,代碼行數:21,代碼來源:containers.ts

示例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()
    })
開發者ID:antonva,項目名稱:tridactyl,代碼行數:52,代碼來源:content.ts

示例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")
    }
}
開發者ID:antonva,項目名稱:tridactyl,代碼行數:15,代碼來源:containers.ts

示例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)
    }
}
開發者ID:antonva,項目名稱:tridactyl,代碼行數:19,代碼來源:updates.ts

示例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)
}
開發者ID:antonva,項目名稱:tridactyl,代碼行數:6,代碼來源:containers.ts

示例6:

 .catch(error => {
     logger.debug(error)
 })
開發者ID:antonva,項目名稱:tridactyl,代碼行數:3,代碼來源:content.ts

示例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"
開發者ID:antonva,項目名稱:tridactyl,代碼行數:31,代碼來源:content.ts


注:本文中的@src/lib/logging.Logger.debug方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。