Skip to content

Save audit list into storage so it's kept for the next run#595

Merged
paulirish merged 4 commits intoGoogleChrome:masterfrom
wardpeet:extension/save-config
Aug 23, 2016
Merged

Save audit list into storage so it's kept for the next run#595
paulirish merged 4 commits intoGoogleChrome:masterfrom
wardpeet:extension/save-config

Conversation

@wardpeet
Copy link
Collaborator

@wardpeet wardpeet commented Aug 16, 2016

Saves audit list in extension

perhaps tests should be added to the extension as well?


aggregations.forEach(aggregation => {
frag.appendChild(createOptionItem(aggregation.name));
frag.appendChild(createOptionItem(aggregation.name, selectedAudits.indexOf(aggregation.name) > -1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[].includes()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, have to hold off until we're node 6 only :)

Copy link
Member

@paulirish paulirish Aug 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow. did not expect that.

image

bummer.

audits = window.getListOfAudits().map(aggregation => aggregation.name);
}
// create list of default audits
const listOfAudits = window.getListOfAudits().map(aggregation => aggregation.name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't really follow this bit too closely. Whatcha thinkin?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.getListOfAudits() gives me the array with all available audits (checkboxes in the extension). I fetch the name for every bit and than make an object that has the audit as key and value as a boolean. For the list of default audits i put it on true and let the user overwrite it with whatever is in storage.

This gives us the possibility to add more audits without changing storage key with a version in the name.

when looking at that piece of code I can reduce a few lines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah agree. looks like you can do the map and reduce in the same pass. might as well move it to forEach.

@paulirish
Copy link
Member

Once you clarify that map/reduce/assign deal at the end, I think we're good to go.

@paulirish paulirish added the lgtm label Aug 20, 2016
@wardpeet
Copy link
Collaborator Author

Updated

@wardpeet wardpeet force-pushed the extension/save-config branch from 20b9d3c to d1c7177 Compare August 23, 2016 05:18
@paulirish paulirish merged commit 5c72d72 into GoogleChrome:master Aug 23, 2016
@paulirish
Copy link
Member

nice thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants