INNER CODE UNIT · JavaScript

handler

cyrus-and/chrome-remote-interface · lib/api.js:32

    const handler = (params, sessionId, callback) => {
        return chrome.send(commandName, params, sessionId, callback);
    };
    decorate(handler, 'command', command);
    chrome[commandName] = chrome[domainName][command.name] = handler;
}

function addEvent(chrome, domainName, event) {
    const eventName = `${domainName}.${event.name}`;
    const handler = (sessionId, handler) => {
        if (typeof sessionId === 'function') {
            handler = sessionId;
            sessionId = undefined;
        }
        const rawEventName = sessionId ? `${eventName}.${sessionId}` : eventName;
        if (typeof handler === 'function') {
            chrome.on(rawEventName, handler);
            return () => chrome.removeListener(rawEventName, handler);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…