// Copyright 2024 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.
import { options } from 'preact';
import { getDisplayName } from '../../utils.js';
import { DIFFED, DOM } from '../renderToOpcodes/constants.js';
export function initRenderAlog() {
    const oldAfterDiff = options[DIFFED];
    options[DIFFED] = function (vnode) {
        // Only log on component vnode
        if (typeof vnode.type === 'function') {
            const threadName = __MAIN_THREAD__ ? 'MainThread' : 'BackgroundThread';
            const displayName = getDisplayName(vnode.type);
            // log the component render into Alog
            if (typeof __MAIN_THREAD__ !== 'undefined' && __MAIN_THREAD__) {
                console.alog?.(`[${threadName} Component Render] name: ${displayName}`);
            }
            else if (typeof __BACKGROUND__ !== 'undefined' && __BACKGROUND__) {
                const dom = vnode[DOM];
                console.alog?.(`[${threadName} Component Render] name: ${displayName}, uniqID: ${dom?.type}, __id: ${dom?.__id}`);
            }
        }
        oldAfterDiff?.(vnode);
    };
}
//# sourceMappingURL=render.js.map