fossasia / susi_chromebot

SUSI.AI Chrome Extension
GNU Lesser General Public License v2.1
1.54k stars 140 forks source link

Duplicate Code #310

Closed haquezameer closed 6 years ago

haquezameer commented 6 years ago

I'm submitting a ... (check one with "x")

Current behavior:

Duplicate code doing the same task exists.

Expected behavior:

Duplicate code should not exist.

Related code:

if(micAccess) {
    micAccess.addEventListener("click", () => {
        navigator.webkitGetUserMedia({
            audio: true
        }, function (stream) {
            stream.stop();
        }, function () {
            console.log("no access");
        });
    });
}
if(preDefThemes) {
preDefThemes.addEventListener("click",(e) => {
    if(e.target!==e.currentTarget){
        theme= e.target.id;
        console.log(theme);
    }

    e.stopPropagation;
    });
}

if(micAccess) {
    micAccess.addEventListener("click", () => {
        navigator.webkitGetUserMedia({
            audio: true
        }, function (stream) {
            stream.stop();
        }, function () {
            console.log("no access");
        });
    });
}

Other information: Check from line number 30 in allowmic.js

System information:

N/A

Would you like to work on the issue? No.

gabru-md commented 6 years ago

@rupav you might want to check this issue in case you are interested to work on this. this seems to be a relatively easy issue and can get you started on this project as well. :+1:

rupav commented 6 years ago

Thanks for letting me know. Claiming it then.