Skip to content

Commit

Permalink
Remove custom event and object.values and object.entries pony/polyfil…
Browse files Browse the repository at this point in the history
…ls (#7355)

Co-authored-by: Wyatt Pearsall <wyatt.pearsall@cfpb.gov>
  • Loading branch information
anselmbradford and wpears committed Nov 29, 2022
1 parent 35232a0 commit b252497
Show file tree
Hide file tree
Showing 45 changed files with 8 additions and 331 deletions.
5 changes: 3 additions & 2 deletions cfgov/unprocessed/apps/teachers-digital-platform/js/modals.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const {
closest,
} = require('@cfpb/cfpb-atomic-component/src/utilities/dom-traverse.js');
const CustomEvt = require('customevent');
const analytics = require('./tdp-analytics');

import { handleSurveyResultsModalClose } from './tdp-analytics.js';

/**
Expand Down Expand Up @@ -29,7 +30,7 @@ class Modal {

const el = this.getElement();

const event = new CustomEvt('modal:open:before', {
const event = new CustomEvent('modal:open:before', {
bubbles: true,
detail: { modal: this },
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const {
closest,
} = require('@cfpb/cfpb-atomic-component/src/utilities/dom-traverse.js');
const objectValues = require('object.values');
const objectEntries = require('object.entries');

const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
Expand Down Expand Up @@ -69,7 +67,7 @@ ChoiceField.get = (name) => {
* @returns {ChoiceField[]} unset choice fields
*/
ChoiceField.findUnsets = () =>
objectValues(ChoiceField.cache).filter((cf) => cf.value === null);
Object.values(ChoiceField.cache).filter((cf) => cf.value === null);

/**
* Remove all the error indicators
Expand Down Expand Up @@ -102,7 +100,7 @@ ChoiceField.restoreFromSession = (key) => {
}
};

objectEntries(ChoiceField.cache).forEach(checkCache);
Object.entries(ChoiceField.cache).forEach(checkCache);

if (update) {
sessionStorage.setItem(key, JSON.stringify(store));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const CustomEvt = require('customevent');

class ProgressBar {
constructor(totalNum, numDone) {
this.totalNum = totalNum;
this.numDone = numDone;

const event = new CustomEvt(ProgressBar.UPDATE_EVT, {
const event = new CustomEvent(ProgressBar.UPDATE_EVT, {
detail: { progressBar: this },
});
document.dispatchEvent(event);
Expand All @@ -18,7 +16,7 @@ class ProgressBar {
update(numDone) {
this.numDone = numDone;

const event = new CustomEvt(ProgressBar.UPDATE_EVT, {
const event = new CustomEvent(ProgressBar.UPDATE_EVT, {
detail: { progressBar: this },
});
document.dispatchEvent(event);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const {
closest,
} = require('@cfpb/cfpb-atomic-component/src/utilities/dom-traverse.js');
const objectEntries = require('object.entries');
const Cookie = require('js-cookie');
const {
ANSWERS_SESS_KEY,
Expand Down Expand Up @@ -75,7 +74,7 @@ function readSurveyData() {
* @type {SurveyData}
*/
const data = Object.create(null);
objectEntries(el.dataset).forEach(([k, v]) => {
Object.entries(el.dataset).forEach(([k, v]) => {
try {
data[k] = JSON.parse(v);
} catch (err) {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions cfgov/unprocessed/apps/teachers-digital-platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"dependencies": {
"aos": "3.0.0-beta.6",
"copy-to-clipboard": "3.3.1",
"customevent": "1.0.1",
"js-cookie": "2.2.1",
"object.entries": "1.1.4",
"object.values": "1.1.4",
"stickyfilljs": "2.1.0"
}
}

0 comments on commit b252497

Please sign in to comment.