why when I resolve a promise, the output is in pending state?

so consider the code below, when I resolve a promise the result is in pending state in the very first moment( I know after I expand the dropdown I will see the expected result but in here I’m questioning the very first moment), while I reject a promise, it shows the expected result in very first moment. so I wonder why is this happening?

code:

 const test = new Promise((resolve, reject) => {
 resolve(Promise.resolve(78))
 })

 console.log(test);

 //output in console:Promise {<pending>}
 const test2 = new Promise((resolve, reject) => {
 reject(Promise.resolve(78))
 })
 
 console.log(test2);

 //output:promise {<rejected>: Promise}

How to bold matched letters when typing in search box using javascript?

How can I type within a search box and have the letters I type turn bold from suggested words? For example, I type “he” in search bar and it looks like this as I type: help. Also, if I type in “lp” the text should appear: help.

I have some code written already and I just want to add this functionality to it, but not sure how to do this. Thank you.

  // List toggle (search bar)
  const searchBar = document.querySelector('#search-bar');
  const searchList = document.querySelector('#search-list');

  searchBar.addEventListener('click', () => {
    searchList.style.display = "block";
  });

  const updateListState = e => {
    const targetId = e.target.id;
    if (targetId !== 'search-bar' && targetId !== 'search-list' && targetId !== 'search-bar-filler' && targetId !== 'search-bar-container' && targetId !== 'search-item-names' && targetId !== 'search-submit' && targetId !== 'search-submit-container') {
      searchList.style.display = "none";
    }
  }
  document.addEventListener('mousemove', updateListState);

  // Letter search (search bar)
  function search_items() {
    let input = document.getElementById('search-bar').value
    input = input.toLowerCase();

    let x = document.getElementsByClassName('search-item-names');

    for (i = 0; i < x.length; i++) {
      if (!x[i].innerHTML.toLowerCase().includes(input)) {
        x[i].style.display = "none";
      }
      else {
        x[i].style.display = "list-item";
      }
    }
  }
  #filler {
    position: absolute;
    background-color: red;
    width: 20px;
    height: 20px;
  }

  #search-list {
    margin-top: 20px;
    width: 150px;
    height: 150px;
    display: none;
  }
  <div id="search-bar-container">
    <input id="search-bar" type="text" name="search" onkeyup="search_items()" placeholder="Search items..">
    <div id="search-bar-filler"></div>
    <div id='search-list'>
      <div id="search-item-names" class="search-item-names">Automotive Degreaser</div>
      <div id="search-item-names" class="search-item-names">Beats by Dre</div>
      <div id="search-item-names" class="search-item-names">JBL Partybox</div>
      <div id="search-item-names" class="search-item-names">Makeup</div>
      <div id="search-item-names" class="search-item-names">Mr Potato Head</div>
      <div id="search-item-names" class="search-item-names">Olympus Camera</div>
      <div id="search-item-names" class="search-item-names">Pillow</div>
      <div id="search-item-names" class="search-item-names">RC Race Car</div>
      <div id="search-item-names" class="search-item-names">Simon Rabbit</div>
      <div id="search-item-names" class="search-item-names">Truth Hoodie</div>
    </div>
  </div>

How can I eliminate or deactivate the white flash that appears when I press a button via a mobile device?

There has to be a way to remove it?

It happens in the code example I provided also.

I can see it when the buttons are clicked via mobile.

Does anyone on here know what I am referring to?

When I tap one of the buttons via mobile, there is a white flash, how do I disable or remove that?

That is all I am trying to do in the code.

https://jsfiddle.net/xmdq14a2/1/

I am not able to take a screenshot of it because it happens too quickly.

To reproduce, tap one of the buttons via a mobile device.

Only occurs via mobile not desktop.

        <button class="linkButtonB btn-primaryC btnC">linkButton</button>
        <button class="linkButtonB btn-primaryC btnC">linkButton</button>
        <button class="linkButtonB btn-primaryC btnC">linkButton</button>
        <button class="linkButtonB btn-primaryC btnC">linkButton</button>

I am not sure what is causing it to occur.

(function manageLinks() {

  const linksButton = [{
    buttonClass: "linkButton btn-primary btn",
    title: "Links"
  }

  ];

  const buttonContainer = document.querySelector(".buttonContainerB");

  linksButton.forEach(function (links) {
    const button = document.createElement("button");
    button.className = links.buttonClass;
    button.textContent = links.title;
    button.classList.add("linkButton", "btnC", "btn-primaryC");
    button.setAttribute("data-destination", "#lb"); // Added this line
    buttonContainer.appendChild(button);
  });
})();

(function manageLinkButtonOpen() {

  function openModal(target) {
    const modal = document.querySelector(target);
    modal.classList.add("active");
  }
  function addLinkToButton() {
    const modalButton = document.querySelector(".linkButton");
    modalButton.addEventListener("click", function (event) {
      //const target = event.currentTarget.dataset.destination;
      //openModal(target);
      openModal(event.currentTarget.dataset.destination);

    });
  }
  addLinkToButton();

}());

(function manageLinkButtonClose() {


  function closeModal(modal) {
    modal.classList.remove("active");
  }

 function addCloseEventToModal() {
    const closeModals = document.querySelectorAll(".modalB");
    closeModals.forEach(function (modal) {
      modal.addEventListener("click", function (event) {
        //closeModal(event.target.closest(".modalB"));
        closeModal(document.querySelector(".modalB"));
      });
    });
  }
  addCloseEventToModal();
}());
body {
  margin: 0;
  padding: 0;
}

body {
  background: #121212;
  padding: 0 8px 0;
}

/*body:has(.outer-container:not(.hide)) {
  padding-top: 0;
}*/

body:has(.modal.active) {
  overflow: hidden;
}

body:has(.modalB.active) {
  overflow: hidden;
}

.outer-container {
  display: flex;
  min-height: 100vh;
  /*justify-content: center;
  flex-direction: column;*/
}

.buttonContainerB {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  max-width: 569px;
  gap: 10px;
}

/*.buttonContainerC {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  max-width: 569px;
  gap: 10px;
}
*/
.buttonContainerC {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: space-around;
    max-width: 569px;
    gap: 10px;
}

.buttonContainerC:after{
  content:"";
  flex-basis:183px;
}





.btn-primaryC {
  color: #2fdcfe;
  background-color: #000000;
  border-color: #2fdcfe;
}

.btnC {
  display: inline-block;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  background-color: #000000;
  border: 1px solid red;
  box-sizing: border-box;
  padding: 6px 12px;
  font-size: 16px;
  border-radius: 4px;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-style: normal;
}



.btn-primaryD {
  color: #2fdcfe;
  background-color: #000000;
  border-color: #2fdcfe;
}

.btnD {
  display: inline-block;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  background-color: #000000;
  border: 1px solid #2fdcfe;
  box-sizing: border-box;
  padding: 6px 12px;
  font-size: 16px;
  border-radius: 4px;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-style: normal;
}


.linkButtonB {
    flex-basis: 183px;
    /* width of each button */
    margin: 0;
    /* spacing between buttons */

    cursor: pointer;
}


.linkButton {
    flex-basis: 183px;
    /* width of each button */
    margin: 0;
    /* spacing between buttons */

    cursor: pointer;
}

.containerD.hide {
  display: none;
}


.modalB {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  /*background: rgba(0, 0, 0, 0.4);*/
  transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out;
  transform: translate(0, -25%);
  opacity: 0;
  pointer-events: none;
  z-index: -99;
  overflow: auto;
  border-radius: 50%;
}

.modalB.active {
  /* display: flex;*/
  opacity: 1;
  transform: scale(1);
  z-index: 1000;
  pointer-events: initial;
  border-radius: 0;
  overflow: auto;
  padding: 8px 8px;
}

.inner-modalB {
  position: relative;
  margin: auto;
}

.containerC {
  /*display: flex;
  flex-wrap: wrap;
  flex-direction: column;*/
  /* added*/
  /* min-height: 100%;*/
  margin: auto;
  /* justify-content: center;
  align-content: center;*/
}

.containerC.hide {
  display: none;
}





.modal-footer {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: calc(16px - (8px * 0.5));
    background-color: transparent;
    border-top: 1px solid transparent;
    border-bottom-right-radius: calc(8px - 1px);
    border-bottom-left-radius: calc(8px - 1px);
}

.exitC {
  transform: translatey(100%);
  margin: -65px auto 0;
  inset: 0 0 0 0;
  width: 47px;
  height: 47px;
  background: black;
  border-radius: 50%;
  border: 5px solid red;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.exitC::before,
.exitC::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 5px;
  background: red;
  transform: rotate(45deg);
}

.exitC::after {
  transform: rotate(-45deg);
}

.closeB {
  transform: translatey(100%);
   margin: -65px auto 0;
  inset: 0 0 0 0;
  /*margin: auto auto 0;*/
  /*margin: 10px auto 0;*/
  width: 47px;
  height: 47px;
  background: black;
  border-radius: 50%;
  border: 5px solid red;
  display: flex;
  align-items: center;
  justify-content: center;
  /*margin: auto;*/
  cursor: pointer;
}

.closeB::before,
.closeB::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 5px;
  background: red;
  transform: rotate(45deg);
}

.closeB::after {
  transform: rotate(-45deg);
}
<div class="outer-container ">
    

    <div class="containerC ">
        <div class="modal-contentA">
            <div class="buttonContainerB">
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
                <button class="linkButtonB btn-primaryC btnC">linkButton</button>
            </div>
           <div class="modal-footer">
        <button class="exitC exit" type="button" title="Exit" aria-label="Close"></button>
      </div>
        </div>
        <div id="lb" class="modalB">
            <div class="inner-modalB">

                <div class="buttonContainerC">
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>
                    <a href="#" class="linkButton btn-primaryD btnD" target="_blank">some text </a>

                </div>
                <div class="linkButton"></div>
 <div class="modal-footer">
          <button class="closeB exit">&times</button>
      </div>
            </div>
        </div>
    </div>
</div>

React Grid Drag n Drop

I would like to start by saying that I’m a beginner and I’m trying to learn React so please don’t be too harsh if my question is dumb.

I’m trying to learn to animate my pages a bit, and I’ve seen that you can have a Drag and Drop feature on different elements on your page.

I’ve heard about libraries such as React DnD or Framer that can help you achieve that but I noticed from the tutorials I watched that they use react state in way or another. My grid is hard coded without using state and creating the layout using items.map() as people might normally do.

I want my grid to behave similarly to this one https://nevflynn.com/

I’m not sure how this person did it and if anyone can tell me what method he might have used or hint me in the right direction would be greatly appreciated!

function App() {
  return (
    <>
      <Header />

      <div className="grid-wrapper">
        <div className="box" id="one"></div>
        <div className="box"></div>
        <div className="box" id="three"></div>
        <div className="box"></div>
        <div className="box"></div>
        <div className="box"></div>
        <div className="box"></div>
        <div className="box"></div>
        <div className="box" id="ninth"></div>
      </div>
    </>
  );
}

Thank you for your time.

I tried making my grid using Framer and the recommended method.

The problem was that it wrapped my grid with a UL with each grid box being wrapped in an LI and the drag and drop animation was really off, seemed like it clearly is not the way to do it.

I’ve seen another method using React Grid DND but again I had to use state.

function App() {
  let [items, setItems] = useState([1, 2, 3, 4, 5, 6, 7, 8, 9]);
  return (
    <>
      <Header />

      <div className="grid-wrapper">
        <Reorder.Group values={items} onReorder={setItems}>
          {items.map((item) => (
            <Reorder.Item value={item} key={item}>
              <div className="box" key={item}></div>
            </Reorder.Item>
          ))}
        </Reorder.Group>
      </div>
    </>
  );
}

Convert String UTC Date to number for ngx-countdown leftTime config value

I’m calling a C# API that’s returning the following types to my Angular application.

export interface Auction {
      reservePrice: number        
      currentHighBid: number    
      auctionEnd: string   
      id: string         
}

I created an AuctionListComponent that will ngFor a list of auction to the screen and in the list I want to add a countdown timers. So I created another component for that called TimerComponent. The parent component is passing a UTC string date to the child. The child timer component needs a type of number for the ngx-countdown timer to work. I’m no pro at Angular so am I missing something simple here?

I’ve also looked over this similar questions as well and didn’t help me.
similar question

Link to nxg-countdown page

(Parent) AuctionListComponent.html

        <div class="m-3" *ngFor="let auction of auctions">

         <p class="card-text">
              End Date: {{ auction.auctionEnd | date }}    
         </p>                   
                                                        
          <app-timer [childTimer]="auction.auctionEnd"></app-timer>                             
            
        </div>

(Child) TimerComponent.html

   <p>
    From the parent: <b>{{ childTimer | date : 'MM d, y, h:mm:ss a' }}</b>  
    UTC: <b>{{ childTimer }}</b>    
    </p>

    <p>ngx-countdown Counter</p>

    <countdown [config]="config"> </countdown> 

TimerComponent.TS

 import { Component, Input } from '@angular/core';
 import { CountdownConfig, CountdownEvent } from 'ngx-countdown';

@Component({
  selector: 'app-timer',
  templateUrl: './timer.component.html',
  styleUrl: './timer.component.scss'
 })
export class TimerComponent {

   @Input() childTimer: string = ''; //This doesn't work because it's the wrong type
   @Input() childTimer: any; //This compiles and give an error
                             //ERROR Error: Unable to convert "Invalid Date" into a date

   config: CountdownConfig = { leftTime: this.childTimer, format: 'd:H:M:ss'};

}

User from database is not found but code do not respond with error

Im creating a simple login webpage which send json request with nicname and server has to check if nickname is in connected local database in MySQL but even if is no such row witch nickname “John”, code respond is Logged. What am i doing wrong?

const express = require('express')
const path = require('path')
const mysql = require('mysql2')

const app = express()

const pool = mysql.createConnection({
  host: "localhost",
  port:'3306',
  user: 'root',
  password:'1234567890',
  database:'mydb'
})

app.use(express.json())
app.use(express.static('client'))

app.post('/', (req,res) =>{
  const loginCode = `select * from users where nickname="${req.body.nickname}"`
  pool.query(loginCode, (err,resoult) =>{
    if(err){
      return console.log('NotLogged')
    }
     console.log('logged'+ resoult[0])
  })
  

})

app.listen(3000, ()=>{
  console.log('server is running at port 3000')
})


I need some help with coed

Having img is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`

I’ve created a React.js project but it gives me img is a void element tag and must neither have children nor use dangerouslySetInnerHTML error. Here is my code:

     <a>
        <img src="/images/2.svg" alt="logo" />
      </a>
     <RightMenu>
        <CustomMenu onClick={()=> setBurgerStatus(true)}/>
      </RightMenu>
      <BurgerNav show={burgerStatus}>
        <CloseWrapper>
          <CustomClose onClick={()=> setBurgerStatus(false)}/>
        </CloseWrapper>
        <li><a href='#'>Vizyon</a></li>
        <li><a href='#'>Vizyon</a></li>
        <li><a href='#'>Misyon</a></li>
        <li><a href='#'>Neden Biz?</a></li>
        <li><a href='#'>Ekibimiz</a></li>
        <li><a href='./Contact.js'>İletişim</a></li>
      </BurgerNav>

I’ve tried to reinstall node-modules but nothing changed.

Didn’t declared variable still not getting any error in JavaScript [duplicate]

I was creating a validation form and by chance, I changed innerHTML of a div tag without declaring it at the top but that worked. I am not getting why that works without even declaring the error variable for div where I want to show the error

if(name == "") {
    // why it works although I didn't
    // declared nameError
    nameError.innerHTML = "Name is required";
}

Following is the codepen example

https://codepen.io/ihtisham-khan/pen/dyLVLeV

Use XLSX Node Module in SAPUI5

I am currently building an application that should export an XLSX file (but not table data, I have some data that I want to put into an XLSX in a specific way). Since I couldn’t find any way to do it with SAPUI5 standard components (sap.ui.export.Spreadsheet does not work for me, since it would need table like data) I was thinking about including the nodeJS XLSX Module. To do that I tried to follow the following tutorial: Using NPM Packages in UI5 without Shims, but after doing the first few steps I realized that this is just working for custom components.

Has anyone an idea how to realize that in a different way?

Creating a javascript filter

I have a vuetify data table as well as a sidebar with all the headers of the table and a filter that should have the following behavior:

  1. Default is no options are chosen and all records of the table are shown
  2. If a user selects items in one of the filter drop downs, once they click off the changes are applied and the datatable is filtered to just those selected results and the remaining filters items array (potential selections) are limited just the options available on the screen. So the filters should dwindle down to nothing as more and more options are selected such that they are dynamic in a sense. Similar to excel except with excel by default all options are chosen and you are deselecting unlike mine which is somewhat reversed with options not selected.

What I need to do is basically take the union of a single filters options and then intersect that with every other filters unions.

So far this was my idea but the logic is flawed:

<template>
  <v-container>
    <v-row class="justify-space-between">
      <h1 class="text-h4 pb-10 mx-5">Dashboard</h1>
      <v-btn rounded="lg" @click="filterDrawer = !filterDrawer" color="primaryLighten5" class="mx-5" flat>
        <template v-slot:prepend>
          <v-icon color="primary" icon="mdi-filter" class="text-primaryDarken4"/>
        </template>
        <div class="text-primaryDarken4">
          Filters
        </div>
      </v-btn>
    </v-row>
    <v-row>
        <v-data-table class="pa-5" :headers="filteredHeaders" :items="displayedReviews"></v-data-table>
        <v-navigation-drawer
          :location="mdAndUp ? 'right' : 'top'"
          floating
          width="400"
          v-model="filterDrawer"
          class="pt-10 px-5 pb-5"
          permanent
          >
          <v-card color="primaryLighten5" class="rounded-xl pa-5 h-100 text-primaryDarken4" flat>
            <div class="h-100 overflow-y-auto">
              <div class="d-flex justify-end">
                <v-btn v-if="!mdAndUp" icon="mdi-close" @click="filterDrawer = !filterDrawer" size="small" variant="tonal"></v-btn>
              </div>
              <v-card-item>
                <v-card-title class="text-center mb-3">Filters</v-card-title>
                  <div class="d-flex justify-end">
                    <v-btn  flat
                            color="error"
                            variant="plain"
                            >
                        Clear All
                    </v-btn>
                  </div>
                  <div class="font-weight-normal">
                    <v-text-field
                      class="my-5"
                      append-inner-icon="mdi-magnify"
                      label="Dynamic Search"
                      multiple
                      density="compact"
                      variant="outlined"
                      hide-details
                      single-line
                      flat
                    ></v-text-field>
                    <v-autocomplete
                      v-for="(header,index) in headers"
                      :key="index"
                      v-model="header.filtered"
                      class="my-5"
                      clearable
                      chips
                      :label="header.title"
                      :items="getUniqueList(reviews,header.key)"
                      multiple
                      density="compact"
                      variant="outlined"
                      hide-details
                      single-line
                      flat
                    >
                      <template v-slot:append-inner>
                        <v-btn @click.prevent="header.visible = !header.visible" flat variant="plain" size="small" :icon="header.visible ? 'mdi-eye' : 'mdi-eye-off'"/>
                      </template>
                    </v-autocomplete>
                    <v-btn @click="applyFilters()" rounded="lg" color="primaryDarken4" class="mt-8" prepend-icon="mdi-filter" size="large" block>Apply</v-btn>
                  </div>
              </v-card-item>
            </div>
          </v-card>
        </v-navigation-drawer>
    </v-row>
  </v-container>
</template>

<script lang="ts" setup>
  import {ref, watch, computed} from 'vue'
  import { useDisplay } from 'vuetify'

  const { mdAndUp } = useDisplay()

  const filterDrawer = ref<boolean>(true)
  
  const headers = ref<any>([
        { title: 'Id', key: 'id', align: 'center', visible: true, filtered: [] },
        { title: 'Tracker', key: 'tracker', align: 'center', visible: true, filtered: [] },
        { title: 'State', key: 'state', align: 'center', visible: true, filtered: [] },
        { title: 'Programs', key: 'program', align: 'center', visible: true, filtered: [] },
        { title: 'Start Date', key: 'start', align: 'center', visible: true, filtered: [] },
        { title: 'End Date', key: 'end', align: 'center', visible: true, filtered: [] },
  ])
  const reviews = ref<any[]>([
    {
      id: '10001',
      tracker: 'test',
      state: 'MD',
      program: 'Dental',
      start: '1/1/2022',
      end: '12/31/2022'
    },
    {
      id: '10002',
      tracker: 'test2',
      state: 'MD',
      program: 'Dental',
      start: '1/1/2022',
      end: '12/31/2022'
    },
    {
      id: '10003',
      tracker: 'test3',
      state: 'VA',
      program: 'Vision',
      start: '1/1/2023',
      end: '12/31/2024'
    },
  ])

  const displayedReviews = ref<any>([])
  
  displayedReviews.value = reviews.value
  
  const applyFilters = () => {
    displayedReviews.value = filteredReviews
  }
  const getUniqueList = (arr: any, property: string ) => {
    return [...new Set(arr.map((item: { [x: string]: any; }) => item[property]))].sort()
  }

  watch(mdAndUp, () => {
    if(mdAndUp.value) {
      filterDrawer.value = true
    } else {
      filterDrawer.value = false
    }
  })

  const filteredHeaders = computed(() => {
    return headers.value.filter((header: { visible: boolean; }) => header.visible === true)
  })

  const filteredReviews = computed(() => {
    var arr = reviews.value
    var atleastOneFilterChecked = false

    headers.value.forEach((header) => {
      if(header.filtered.length > 0) {
        header.filtered.forEach((filter) => {
          atleastOneFilterChecked = true
          arr = arr.filter((review) => review[header.key] == filter)
        });
      }
    });
    return atleastOneFilterChecked ? arr : reviews.value
  })
</script>

How can I catch all DOMExceptions thrown in Firefox?

I would like to create a method that returns an iframe’s URL if the parent page is allowed to (because it is under the same domain), and return a falsy value if the parent page is not allowed to do so.

I have the following code hosted by https://cjshayward.com:

<!DOCTYPE html> 
<html>
    <head>
    </head>
    <body> 
        <iframe name="test_frame" id="test_frame"
        src="https://cjshayward.com"></iframe>
        <script>
            setTimeout(function()
                {
                try
                    {
                    console.log(window.frames.testframe.location.href);
                    }
                catch(error)
                    {
                    console.log('Not able to load.');
                    });
                }, 1000);
        </script>
    </body>
</html>

The setTimeout() is used because if I specify an iframe and then immediately have JavaScript attempt to load the page’s URL, it will load a URL of about:blank.

But when I change the URL to the script in the same place to another domain (that has no restrictions on e.g. loading contents in a frame), Firefox logs the string specified in the catch block, and still logs an uncaught DOMException:

<!DOCTYPE html> 
<html>
    <head>
    </head>
    <body> 
        <iframe name="test_frame" id="test_frame"
        src="https://orthodoxchurchfathers.com"></iframe>
        <script>
            setTimeout(function()
                {
                try
                    {
                    console.log(window.frames.testframe.location.href);
                    }
                catch(error)
                    {
                    console.log('Not able to load.');
                    });
                }, 1000);
        </script>
    </body>
</html>

In the first case, it logs https://cjshayward.com. In the second case, it logs “Not able to load,” but still shows an uncaught DOMException in the log.

How can I make a function that returns the iframe’s location.href if it is available, and returns something falsy like an empty string if the same is not available due to browser security restrictions?

Or, taking a slight step back, is the logged DOMException unimportant? If I replace the console.log() calls with return calls from within a function, will my code be able to use the return value as the iframe’s URL if such is available and a falsy value if it is not available?

TIA,

Why does the roblox api keep 403’ing me?

Right now im using an x-csrf token, ctype password and cvalue (my actual username with cvalue and password), user id which is jsut some random letters, for captcha token i wrote in CAPTCHATOKENFROMFUNCAPTCHA, captcha provider as arkose labs and “captcha” as captchaid. Default stuff for headers, nothing roblox specific.
What else do i need? do i need to render an actual captcha?
To bypass CORS im using roproxy.

ive trierd copying the cookies from the official roblox login page requests , and trying to get the authority to count as roblox.com. dosent seem to work.
Response is just 403 code 0

why throw inside of an setTimeout, located inside a promise, doesn’t change state and result of the output promise? [duplicate]

I know existence of a throw inside of a promise, change the state of that specific promise to rejected and the result will be the error message, but when I type this throw inside of a setTimeout located inside of a promise, that throw doesn’t modify the state and result of that promise, at first I thought maybe there is something wrong with setTimeout, but I tried resolve() and reject() inside that setTimeout and I received the expected result. so I wonder why this happen with a throw located in setTimeout inside of a promise?

code:

const test = new Promise((resolve, reject) => {
setTimeout(() => {
    throw new Error("error");
}, 2000)
});

//output after 2 sec: [[PromiseState]]: pending
                    //[[PromiseResult]]: undefined;
 const test = new Promise((resolve, reject) => {
 setTimeout(() => {
    resolve("success");
 }, 2000)
 });

 //output after 2 sec:[[PromiseState]]: fulfilled
                    //[[PromiseResult]]: success

SuiteScript 1 Issue – Unable to populate Created From ID on another field

Very new to NetSuite scripting. I am writing a very basic workflow action script to take the ID of the created from transaction (which is already referenced on the current transaction form), and then populate that ID into the new transaction ID field. But it keeps populating the words “createdFromID” instead of the actual ID.

function wf_populateField() {‌ nlapiSetFieldValue('tranid','createdFromId'); }

Non-blocking state update

there! I was wondering if Svelte has a way to update state in a non-blocking fashion.
Here’s artifically slow tabs example. https://svelte.dev/repl/565c333f0ab141c1a97e96f855d2e7d0?version=4.2.12

As you can see, when you switch Tab 2, it prevents tab button from being active until tab content rendering finishes.
It makes the UI feel less snappy.

I was seeking something like useTransition in React: https://react.dev/reference/react/useTransition#marking-a-state-update-as-a-non-blocking-transition

Thanks in advance!