filter locations along the route

I have a project, I determine the start and end point and there are a lot of locations in my own API, I create a route from Google with the start and end point of these locations and I want to filter my locations on that route.

How to write “variables” inside var? [duplicate]

I have a script on my website. I need to call to this script on several pages.

The script looks like this :

<div id="Widget12345" data-id-projet='12345'>Chargement en cours...</div>
<script type="text/javascript">
var oooWidgetUrl12345, 
    oooTypeModule12345; 
    oooWidgetUrl12345 = 'https://mybookingsystem.com/Widget12345?idoi=67890';
    constellationTypeModule12345=2; 
    constellationBookingCalendarLoadWidget12345; 
    constellationWidgetAddEvent(window, "resize", function () { 
    constellationWidgetSetAppearanceWidget12345; });</script>

In this exemple, 12345 (and also 67890) is different on every page, so I would like to include variables every time these numbers are called in my script. To have something like this (and I just would have to dynamically modify $var1 and $var2 at the top of the script) :

$var1 = 12345
$var2 = 67890

But I’m not good in javascript, and this syntax is not good 🙂

Could you help me to write it with the good syntax ?
Hope I am clear enough.
Thanks in advance for your help !

TokenURL request in Node.js

I’m trying to make a request to complete the OAuth process for the Bungie API following their documentation.

For starters, you have to create an authorization link for the user using your application’s Client ID:

const crypto = require('crypto');

const clientID = process.env.BNG_CLIENT_ID;
const authURL = 'https://www.bungie.net/en/oauth/authorize';

// Create authorization link.
const authState = crypto.randomBytes(20).toString('hex');
console.log(`${authURL}?client_id=${clientID}&response_type=code&state=${authState}`);

The authorization link seems to work just fine, and then it redirects the user to a previously specified link, except now it has an extra query parameter that gives you the Authorization Code you need to request the Access Token.

This is where I’m stuck at:

const clientSecret = process.env.BNG_CLIENT_SECRET;
const tokenURL = 'https://www.bungie.net/platform/app/oauth/token';
const authCode = 'The authentication code :)';

fetch(tokenURL, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Authorization': `Basic ${btoa(`${clientID}:${clientSecret}`)}`
    },
    body: new URLSearchParams({
        'client_id': clientID,
        'grant_type': 'authorization_code',
        'code': authCode
    }).toString()
}).then(res => {
    console.log(res);
    return res.json();
});

This is the current state of my code, this request returns a 400 (Bad Request) status. Other things I’ve tried have returned a 401 (Unauthorized) status, but it’s practically the same.

Already tried using client_id and client_secret as a query parameter directly into the string instead of using the Authorization header, same deal.

js eventListener fires twice upon uncollapsing bootstrap accordion

I have 2 pages with bootstrap accordions. With one page, everything works as expected, however, the other one fires always 2 events when uncollapsing the accordion.

The page working fine only triggers a data upload, while the one firing twice has some lazy load logic before the upload statements.

This is the JS code for the page firing twice. Evidence for firing twice is that apiloginteraction.php is storing the record twice in the log database.

Any idea what is causing this?

    var equipment_loaded = false;

    async function addAccordionListeners() {
      var collapseEquipment = document.getElementById('collapseEquipment');

      if (collapseEquipment && !equipment_loaded) {
        collapseEquipment.addEventListener('shown.bs.collapse', function() {
          if (!equipment_loaded) {
            phpFile = 'mequipment_content.php';
            updateAccordionData('/presentation/mobile/' + phpFile, 'equipment-load-div', ['domEqmntSrc1'], ['domEqmntTgt1']);
            equipment_loaded = true;
          }
          
          var scrollOffset = mainAccordion.scrollTop + collapseEquipment.parentNode.offsetTop
          window.scroll({
            top: scrollOffset,
            left: 0,
            behavior: 'smooth'
          });
          
          fetch('/api/apiloginteraction.php', {
            method: 'POST',
            body: JSON.stringify({
              page: page,
              section: 'equipment',
              lan: document.getElementById("lan").value
            }),
            headers: {
              'Content-type': 'application/json; charset=UTF-8',
            }
          })
        });
      }
    }

The function for adding the listeners (each page, the working and the non-working page, has a separate function to add the listeners) is called from within the body of the page like this:

    <script>
        $( document ).ready(function() {
            window.scrollTo(0,0);
            addAccordionListeners();
        });
    </script>

All lazy load logic is within the 2nd if statement. It simply loads content when uncollapsing the accordion, unless the content is already loaded.

The mechanism for transforming JavaScript syntactic sugar in V8 using async/await as an example

Is syntactic sugar such as async/await converted before compilation/interpretation?
Attention. I mean the situation when the engine supports the syntax of our code and we do not need to transpile it. I consider the issue in isolation from transpilation.

The neuron provides information that before the compilation/interpretation process there is a transformation that converts syntactic sugar into simpler structures.

Example:

const testFunction = async () => {
  let testPromise = new Promise((resolve, reject) =>
    setTimeout(() => {
      resolve('testResolve');
    }, 1110)
  );

  let result = await testPromise;
  console.log('Проверка');
  console.log('result', result);
};

testFunction();

Will it be converted into something similar before compilation?

const testFunction = () => {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve('testResolve');
        }, 1110);
    })
    .then(result => {
        console.log('Проверка');
        console.log('result', result);
    })
};

I tried to use google in many variants of queries but no info about transformation syntactic sugar

Amazon SP-API price and stock update issue

 `   let response;
    let submissionId;

    const replaceBodyData = {
      productType : productType,
      patches: [
        {
          op: 'replace',
          path: '/attributes/purchasable_offer',
          value: [{
            marketplace_id: MARKETPLACE_ID,
              currency: 'TRY',
            purchasable_offer: [{
           "our_price": [
      {"schedule": [{"value_with_tax": price}]}
                ],
            }],
          }]
        },
        {
          op: 'replace',
          operation_type: 'PARTIAL_UPDATE',
          path: '/attributes/fulfillment_availability',
          value: [{
            fulfillment_channel_code: 'DEFAULT',
            quantity: String(quantity),
            marketplace_id: MARKETPLACE_ID,
          }]
        },
      ]
    };`
`[DEBUG] getListingsItem SUCCESS yan─▒t─▒: {
  "sku": "AE H66F",
  "summaries": [
    {
      "marketplaceId": "A33AVAJ2PDY3EV",
      "asin": "B09JKYXFSJ",
      "productType": "ELECTRONIC_COMPONENT_FAN",
      "conditionType": "new_new",
      "status": [
        "BUYABLE",
        "DISCOVERABLE"
      ],
      "itemName": "Aerocool H66F fan kontrol├╝",
      "createdDate": "2024-12-26T09:52:53.053Z",
      "lastUpdatedDate": "2024-12-26T09:52:53.053Z",
      "mainImage": {
        "link": "https://m.media-amazon.com/images/I/31+Y302QIAL.jpg",
        "height": 500,
        "width": 500
      }
    }
  ]
}
[DEBUG] getListingsItem => productType: ELECTRONIC_COMPONENT_FAN
[DEBUG] patchListingsItem REPLACE => {
  "productType": "ELECTRONIC_COMPONENT_FAN",
  "patches": [
    {
      "op": "replace",
      "path": "/attributes/purchasable_offer",
      "value": [
        {
          "marketplace_id": "A33AVAJ2PDY3EV",
          "currency": "TRY",
          "purchasable_offer": [
            {
              "our_price": [
                {
                  "schedule": [
                    {
                      "value_with_tax": "668.00"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "op": "replace",
      "operation_type": "PARTIAL_UPDATE",
      "path": "/attributes/fulfillment_availability",
      "value": [
        {
          "fulfillment_channel_code": "DEFAULT",
          "quantity": "36",
          "marketplace_id": "A33AVAJ2PDY3EV"
        }
      ]
    }
  ]
}
[DEBUG] REPLACE Yan─▒t => {
  "sku": "AE H66F",
  "status": "ACCEPTED",
  "submissionId": "79bdf335dfa54035bac8e9b8f01c62e3",
  "issues": []
}
[DEBUG] Fiyat g├╝ncelleme iste─şi g├Ânderildi. Submission ID: 79bdf335dfa54035bac8e9b8f01c62e3
[DEBUG] API Yan─▒t─▒: {
  "sku": "AE H66F",
  "status": "ACCEPTED",
  "submissionId": "79bdf335dfa54035bac8e9b8f01c62e3",
  "issues": []
}`

I am working on an Electron-Vue project and using Amazon SP-API to update both stock and price for products. I’m sending the request to the SP-API using the op: ‘replace’ operation. While stock updates successfully, the price does not update.

The returned response indicates everything is fine, but the price data is not updating when I check in Seller Central. If anyone knows the solution, please help.

Unable to find a specification for `ReactCommon/turbomodule/core (= 0.66.3)` depended upon by `React-RCTBlob`

ios % pod install –repo-update
Auto-linking React Native modules for target Mshika: RNCAsyncStorage, RNCMaskedView, RNCPushNotificationIOS, RNDateTimePicker, RNDeviceInfo, RNGestureHandler, RNReanimated, RNSVG, RNScreens, RNSnackbar, RNVectorIcons, ReactNativeART, react-native-camera, react-native-document-picker, react-native-geolocation-service, react-native-image-picker, react-native-keep-awake, react-native-netinfo, react-native-restart, react-native-safe-area-context, and react-native-text-input-mask
Updating local specs repositories
Analyzing dependencies
Fetching podspec for DoubleConversion from ../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
Fetching podspec for glog from ../node_modules/react-native/third-party-podspecs/glog.podspec
[!] Unable to find a specification for ReactCommon/turbomodule/core (= 0.66.3) depended upon by React-RCTBlob

You have either:

  • mistyped the name or version.
  • not added the source repo that hosts the Podspec to your Podfile.

im using react native version 0.66.3

I tried to check the node_modules for that module, i couldnt find it…. has anyone come accross this challenge before ??

Focus textarea after appending and removing div

I’m trying to get the caret global position by appending then removing a div into a textarea. When I do execute my function, I get the global position but am unable to set the focus back to the textarea.

function getCaretPos(){
    var area = $('textarea');
    var tracker = $('<div id="tracker"></div>');
    var range = window.getSelection().getRangeAt(0);
    range.insertNode(tracker[0]);
    var pos = tracker.offset();
    tracker.remove();
    tracker = null;
    setTimeout(() => {
        area.focus();
    }, 0);        
    return pos;
}

$('textarea').on('input', () => {
    console.log(getCaretPos());
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<textarea></textarea>

Please note that after I execute this function, even typing in the console $('textarea').focus() does not focusses the textarea again. What am I missing?

react native sqlite storage convert json value stored in db back into javascript object [closed]

I am storing a JavaScript object as a JSON into my SQLite db

const someData = {
  details: {id: 1, name: 'Hi', userId: 2, email: '[email protected]'}
}

const data = JSON.stringify(someData)

const insertQuery = `INSERT OR REPLACE INTO ${tableName} (answer) VALUES (${data});`
db.executeSql(insertQuery)

Later when I retrieve all the stored data, it returns an array of JSON objects, but whenever I try to use JSON.parse on the array, I get a warning

SyntaxError: JSON Parse error: Unexpected character: o

My SQLite table column is of type TEXT

I need to convert each element in the results when I do a SQLite Select query back into a JavaScript object.

Currently the results from my Select query looks like this

[
 {"details": "{"id": 0,"name": "SOME NAME","userId":2,"email": "someEmail"},
 {"details": "{"id": 1,"name": "SOME NAME 1","userId":2,"email": "someEmail"},
 {"details": "{"id": 2,"name": "SOME NAME 2","userId":2,"email": "someEmail"},
]

I tried looping through the array, then converting each one with JSON.stringify() then JSON.parse() after, but it still is same format

const a = []
results.forEach((r) => {
  const s = JSON.stringify(r)
  const p = JSON.parse(s)

  a.push(p)

  console.log(a) // Shows it still same as JSON array above
})

Debugging when Stripe returns `error “JSON.parse`

I’m using Stripe’s “Embedded form” example verbatim. I am trying to add email consent collection.

In the example’s chekout.php, I add the line 'consent_collection' => ['promotions' => 'auto'] This makes the script at js.stripe.com/v3 return a parse error.

Uncaught (in promise) IntegrationError: fetchClientSecret failed with error "JSON.parse: unexpected end of data at line 1 column 1 of the JSON data"
    r https://js.stripe.com/v3/:1
    n https://js.stripe.com/v3/:1
    r https://js.stripe.com/v3/:1
    t https://js.stripe.com/v3/:1
    e https://js.stripe.com/v3/fingerprinted/js/embedded-checkout-outer-60acd9aac45305c6390331b023b051cf.js:4
    promise callback*e https://js.stripe.com/v3/fingerprinted/js/embedded-checkout-outer-60acd9aac45305c6390331b023b051cf.js:4
    Q https://js.stripe.com/v3/fingerprinted/js/embedded-checkout-outer-60acd9aac45305c6390331b023b051cf.js:4
    Ki https://js.stripe.com/v3/:1
    promise callback*Ki https://js.stripe.com/v3/:1
    initEmbeddedCheckout https://js.stripe.com/v3/:1
    initialize https://testing.ivyaudio.com/checkout.js:16
    <anonymous> https://testing.ivyaudio.com/checkout.js:4
v3:1:712678
    e https://js.stripe.com/v3/fingerprinted/js/embedded-checkout-outer-60acd9aac45305c6390331b023b051cf.js:4
    (Async: promise callback)
    e https://js.stripe.com/v3/fingerprinted/js/embedded-checkout-outer-60acd9aac45305c6390331b023b051cf.js:4
    Q https://js.stripe.com/v3/fingerprinted/js/embedded-checkout-outer-60acd9aac45305c6390331b023b051cf.js:4
    Ki https://js.stripe.com/v3/:1
    (Async: promise callback)
    Ki https://js.stripe.com/v3/:1
    initEmbeddedCheckout https://js.stripe.com/v3/:1
    initialize https://testing.ivyaudio.com/checkout.js:16
    <anonymous> https://testing.ivyaudio.com/checkout.js:4

The same error appears when I attempt other changes, like changing payment to subscription, as suggested in the example doc.

Stripe has a troubleshooting doc, but it assumes it’s your own js returning the error, not theirs.

Clearly I am missing something. How can I get a look at the object causing the parse error, and why does Stripe throw an error if I change anything in the checkout_session?

Binary file base64 encode in js and decode in python

I want save an excel file as json in database. It is then downloaded in the python backend later on to create the excel file.

My frontend to save excel file as json:

      const fileReader: FileReader = new FileReader();    
      fileReader.onloadend = (_x) => {
        const input: any = {
          name: file.name,
          content: {
            author: 'username',
            
            excelFile: fileReader.result,
          },
        };

        httprequest({params: input}).subscribe();
      };
      fileReader.readAsDataURL(file);

Python backend to create excel file from json:

data = api_client.get_file_details(id)
decoded_excel = base64.b64decode(data["content"]["excelFile"])
with open('example.xlsx', "wb") as f:
    f.write(decoded_excel)

Unfortunately python decoding does not work. It gives error Error: Invalid base64-encoded string: number of data characters (587469) cannot be 1 more than a multiple of 4. How can solve this issue?

React PDF viewer shows boxes instead of text in a new window, but works fine in the same window

I’m using the @react-pdf-viewer library to render PDFs in my React application. The viewer works perfectly when opened in the same window, but when I try to render the viewer in a new browser window, only the boxes are shown and the text is not visible. When I copy the boxes and paste them into a text editor (e.g., Notepad), the content appears correctly.

Here’s my implementation to load the required resources into the new window:

export const loadPdfResources = (newWindow: any) => {
  const resources = [
    { type: 'stylesheet', href: 'https://unpkg.com/@react-pdf-viewer/core/lib/styles/index.css' },
    { type: 'stylesheet', href: 'https://unpkg.com/@react-pdf-viewer/default-layout/lib/styles/index.css' },
    { type: 'stylesheet', href: 'https://unpkg.com/@react-pdf-viewer/zoom/lib/styles/index.css' },
    { type: 'stylesheet', href: 'https://unpkg.com/@react-pdf-viewer/search/lib/styles/index.css' },
    { type: 'stylesheet', href: 'https://unpkg.com/pdfjs-dist/web/pdf_viewer.css' },
    { type: 'script', src: 'https://unpkg.com/[email protected]/build/pdf.js' },
    { type: 'script', src: 'https://unpkg.com/[email protected]/web/pdf_viewer.js' }
  ];

  resources.forEach(resource => {
    const element = newWindow.document.createElement(resource.type === 'stylesheet' ? 'link' : 'script');
    if (resource.type === 'stylesheet') {
      element.rel = 'stylesheet';
      element.href = resource.href;
      newWindow.document.head.appendChild(element);
    } else if (resource.type === 'script' && resource.src) {  // Check if src is defined
      element.src = resource.src;
      newWindow.document.head.appendChild(element);
    }
  });
};

Problem:

The PDF viewer renders correctly in the same window but only shows boxes in the new window.
The text content is visible when copied into a text editor like Notepad, but it’s not displayed in the browser window.
I confirmed that all required resources (CSS and JavaScript files) are loaded in the new window.
What I have tried:

I ensured that all the necessary resources are loaded correctly in the new window.
I tried using different versions of the pdf.worker.min.js worker file, but that didn’t solve the issue.
I checked if the issue happens in all browsers, but it’s consistent across different ones.
What could be causing this issue?

Why is the text not visible in the new window, even though the same viewer works in the same window?
Any insights or suggestions on how to resolve this issue would be greatly appreciated!

Text and Image Quality is Very Low

I’m learning to use Phaser. I made a project in Vanilla Framework using Vite.js. In this project, image and font quality are showing very low. When I try to zoom in, then images and fonts are looking blurry. I want to achieve high quality in this project’s texts and images. How to do it?

This is my code : —-

This is mainScene.js script :—

import { Scene } from "phaser";

class MainScene extends Scene {
  constructor() {
    super("MainScene");
  }
  preload() {
    console.log("preload");
    
    this.load.image("gameBG", "/Sprites/gameBG.png");
    this.load.image("mineDefaultLight", "/Sprites/mineDefaultLight.png");
    this.load.image("gameNameBG", "/Sprites/gameNameBG.png");
    this.load.image("arrow", "/Sprites/arrow.png");
    this.load.image("howToPlayBtn", "/Sprites/howToPlayBtn.png");
    this.load.image("menuBtn", "/Sprites/menuBtn.png");
    this.load.image("minesSelectionBG", "/Sprites/minesSelectionBG.png");
    this.load.image("nextBG", "/Sprites/nextBG.png");
    this.load.image("randomBG", "/Sprites/randomBG.png");
    this.load.image("autoGameBG", "/Sprites/autoGameBG.png");
    this.load.image("refreshImg", "/Sprites/refresh.png");
    this.load.image("autoToggleOffImg", "/Sprites/autoToggleOff.png");
    this.load.image("betPanelBGImg", "/Sprites/betPanelBG.png");
    this.load.image("customBetFieldImg", "/Sprites/customBetFieldImg.png");
    this.load.image("minusBtnImg", "/Sprites/minus.png");
    this.load.image("betAmountsBtn", "/Sprites/betAmountsBtn.png");
    this.load.image("plusBtnImg", "/Sprites/plus.png");
    this.load.image("autoPlayBtn", "/Sprites/autoPlayBtn.png");
    this.load.image("betBtn", "/Sprites/betBtn.png");
    this.load.image("betBtnArrow", "/Sprites/betBtnArrow.png");
    this.load.image("minesSVG", "/Sprites/MinusSVG.svg"); // Preload the MinesSVG.svg image
    this.load.image("refreshSVG", "/Sprites/refreshSVG.svg");

    this.load.spritesheet("demo", "/Sprites/refresh.png", {frameWidth: 22, frameHeight: 18});
  }
  create() {
    console.log("create");

    let gameBG = this.add.image(0, 0, "gameBG").setOrigin(0, 0);
    gameBG.setDisplaySize(950, 520);
    gameBG.setPosition(5, 5);

    function preserveAspect(image, targetWidth, targetHeight) {
      const scale = Math.min(targetWidth / image.width, targetHeight / image.height);
      image.setScale(scale);
    }

    //Header
    let gameHeaderContainer = this.add.container(7, 7);
    let gameHeader = this.add.graphics();
    gameHeader.fillStyle(0x000000, .3);
    gameHeader.fillRoundedRect(0, 0, 946, 30, 12);
    gameHeaderContainer.add(gameHeader);

    let gameNameBG = this.add.image(3, 3, "gameNameBG").setOrigin(0, 0);
    gameNameBG.setDisplaySize(130, 24);
    gameHeaderContainer.add(gameNameBG);

    let arrow = this.add.image(110, 12, "arrow").setOrigin(0, 0);
    preserveAspect(arrow, 10, 10);
    gameHeaderContainer.add(arrow);

    let gameNameTxt = this.add.text(47.428, 7, "MINES", {
      fontSize: "12px",
      fontFamily: "Roboto",
      color: "#ffffff",
    });
    gameHeaderContainer.add(gameNameTxt);

    let howToPlayBtn = this.add.image(148, 4, "howToPlayBtn").setOrigin(0, 0);
    preserveAspect(howToPlayBtn, 150, 22);
    gameHeaderContainer.add(howToPlayBtn);

    let menuBtn = this.add.image(919, 4, "menuBtn").setOrigin(0, 0);
    preserveAspect(menuBtn, 24, 24);
    gameHeaderContainer.add(menuBtn);

    let totalBalanceTxt = this.add.text(890, 8, "3,000.00  ", {
      fontSize: "12px",
      fontFamily: "Roboto",
      color: "#ffffff",
    }).setOrigin(1, 0);
    let inrText = this.add.text(totalBalanceTxt.x, totalBalanceTxt.y, "INR", {
      fontSize: "12px",
      fontFamily: "Roboto",
      color: "#6C9FC7",
    }).setOrigin(0, 0);
    totalBalanceTxt.setText(totalBalanceTxt.text);
    gameHeaderContainer.add(inrText);
    gameHeaderContainer.add(totalBalanceTxt);
    totalBalanceTxt.setOrigin(1, 0);

    //Middle
    let subHeaderLine = this.add.graphics();
    subHeaderLine.fillStyle(0x000000, .3);
    subHeaderLine.fillRoundedRect(268.955, 71, 422.09, 4, 2);

    const group = this.add.group();
    const rows = 5, columns = 5;
    const cellWidth = 78.9, cellHeight = 59.46;
    const spacingX = 5, spacingY = 6;
    const offsetX = 272.75, offsetY = 84;

    for (let i = 0; i < rows * columns; i++) {
      const col = i % columns;
      const row = Math.floor(i / columns);
      const x = offsetX + col * (cellWidth + spacingX) + cellWidth / 2;
      const y = offsetY + row * (cellHeight + spacingY) + cellHeight / 2;

      const box = this.add.image(x, y, 'mineDefaultLight');
      preserveAspect(box, cellWidth, cellHeight);
      group.add(box);
    }

    //SubFooter
    let subFooterContainer = this.add.container(273, 415);
    let randomBG = this.add.image(0, 0, "randomBG").setOrigin(0, 0);
    randomBG.setDisplaySize(205.27, 30.05);
    subFooterContainer.add(randomBG);

    let randomTxt = this.add.text(70, 7, "RANDOM", {
      fontSize: "14px",
      fontFamily: "Roboto",
      color: "#ffffff",
    });
    subFooterContainer.add(randomTxt);

    let autoGameBG = this.add.image(210, 2, "autoGameBG").setOrigin(0, 0);
    autoGameBG.setDisplaySize(205.23, 26);
    subFooterContainer.add(autoGameBG);

    // let refreshImg = this.add.image(214, 6, "refreshImg").setOrigin(0, 0);
    // preserveAspect(refreshImg, 22, 18);
    // subFooterContainer.add(refreshImg);

    // let refreshSVG = this.add.image(214, 6, "refreshSVG").setOrigin(0, 0);
    // preserveAspect(refreshSVG, 22, 18);
    // subFooterContainer.add(refreshSVG);

    let demoSprite = this.add.sprite(214, 6, "refreshImg");
    demoSprite.setOrigin(0, 0);
    demoSprite.setDisplaySize(22, 18);
    subFooterContainer.add(demoSprite);

    let autoToggleOffImg = this.add.image(264, 7, "autoToggleOffImg").setOrigin(0, 0);
    autoToggleOffImg.setDisplaySize(28, 16);
    subFooterContainer.add(autoToggleOffImg);

    let autoGameTxt = this.add.text(300, 7, "Auto Game", {
      fontSize: "12px",
      fontFamily: "Roboto",
      color: "#ffffff",
    });
    subFooterContainer.add(autoGameTxt);

    //Footer
    let footerContainer = this.add.container(7, 455);

    let gameFooter = this.add.graphics();
    gameFooter.fillStyle(0x000000, .3);
    gameFooter.fillRoundedRect(0, 0, 946, 68, 12);
    footerContainer.add(gameFooter);

    let betPanelBGImg = this.add.image(170, 9, "betPanelBGImg").setOrigin(0, 0);
    betPanelBGImg.setDisplaySize(298, 50);
    footerContainer.add(betPanelBGImg);

    let betINRTxt = this.add.text(232, 16, "Bet INR", {
      fontSize: "12px",
      fontFamily: "Roboto",
      color: "#ffffff",
    });
    footerContainer.add(betINRTxt);

    let customBetFieldImg = this.add.image(184, 30, "customBetFieldImg").setOrigin(0, 0);
    customBetFieldImg.setDisplaySize(142, 22);
    footerContainer.add(customBetFieldImg);

    let betAmountInputField = this.add.text(240, 32, "0.00", {
      fontSize: "14px",
      fontFamily: "Roboto",
      fontStyle: "bold",
      color: "#ffffff",
    }).setOrigin(0, 0);
    footerContainer.add(betAmountInputField);

    let minusBtnImg = this.add.image(340, 20, "minusBtnImg").setOrigin(0, 0);
    preserveAspect(minusBtnImg, 33, 33);
    footerContainer.add(minusBtnImg);

    /* // Add the MinesSVG.svg image at the first position
    let minesSVG = this.add.image(340, 20, "minesSVG").setOrigin(0, 0).setToTop();
    // minesSVG.setDisplaySize(950, 520);
    preserveAspect(minesSVG, 33, 33);
    footerContainer.add(minesSVG); */

    let betAmountsBtn = this.add.image(380, 18, "betAmountsBtn").setOrigin(0, 0);
    preserveAspect(betAmountsBtn, 33, 33);
    footerContainer.add(betAmountsBtn);

    let plusBtnImg = this.add.image(420, 21, "plusBtnImg").setOrigin(0, 0);
    preserveAspect(plusBtnImg, 33, 33);
    footerContainer.add(plusBtnImg);

    let autoPlayBtn = this.add.image(480, 9, "autoPlayBtn").setOrigin(0, 0);
    preserveAspect(autoPlayBtn, 240, 50);
    footerContainer.add(autoPlayBtn);

    let betBtn = this.add.image(535, 10, "betBtn").setOrigin(0, 0);
    betBtn.setDisplaySize(242, 52);
    footerContainer.add(betBtn);

    let betBtnArrow = this.add.image(554, 22.5, "betBtnArrow").setOrigin(0, 0);
    preserveAspect(betBtnArrow, 19, 21);
    footerContainer.add(betBtnArrow);

    let betBtnTxt = this.add.text(645, 26, "BET", {
      fontSize: "14px",
      fontFamily: "Roboto",
      color: "#ffffff",
    });
    footerContainer.add(betBtnTxt);

    //SubHeader
    let subHeaderContainer = this.add.container(268.955, 44);
    let subHeader = this.add.graphics();
    subHeader.fillStyle(0x000000, .3);
    subHeader.fillRoundedRect(0, 0, 422.09, 22, 10);
    subHeaderContainer.add(subHeader);

    let minesSelectionBG = this.add.image(1, 1.5, "minesSelectionBG").setOrigin(0, 0);
    preserveAspect(minesSelectionBG, 138, 20);
    subHeaderContainer.add(minesSelectionBG);

    let minesSelectionTxt = this.add.text(47, 3, "Mines: ", {
      fontSize: "12px",
      fontFamily: "Roboto",
      color: "#ffffff",
    });
    let minesSelectionCount = this.add.text(minesSelectionTxt.x + 35, 3, "3", {
      fontSize: "12px",
      fontFamily: "Roboto",
      color: "#ffffff",
    });
    subHeaderContainer.add(minesSelectionTxt);
    subHeaderContainer.add(minesSelectionCount);

    let arrowRight = this.add.image(122, 8, "arrow").setOrigin(0, 0);
    preserveAspect(arrowRight, 8, 8);
    subHeaderContainer.add(arrowRight);

    let nextBG = this.add.image(318, 1.5, "nextBG").setOrigin(0, 0);
    nextBG.setDisplaySize(102.53, 19);
    subHeaderContainer.add(nextBG);

    let nextTxt = this.add.text(334, 2, "Next: ", {
      fontSize: "14px",
      fontFamily: "Roboto",
      color: "#343A40",
    });
    let nextCount = this.add.text(nextTxt.x + 36, 2, "1.10x", {
      fontSize: "14px",
      fontFamily: "Roboto",
      color: "#343A40",
    });
    subHeaderContainer.add(nextTxt);
    subHeaderContainer.add(nextCount);
  }
}

export default MainScene;

This is config.js script :—-

import Phaser from "phaser";
import MainScene from "./mainScene";

const config = {
  type: Phaser.WEBGL,
  width: 960,
  height: 530,
  backgroundColor: "#131419",
  scene: [MainScene],
  scale: {
    mode: Phaser.Scale.MAX_ZOOM,
    autoCenter: Phaser.Scale.Center.CENTER_BOTH,
  },
};

const game = new Phaser.Game(config);
export default game;

This is My Project Build :—

Build

cordova-plugin-ble-central confirm BLE connection

I am using cordova-plugin-ble-central and I am trying to connect to my Mi Smart Band 4 (also 5 and 6) and all the connection is successful (including pairing). My problem comes when I try to read heartrate data or subscribe to the heartrate data. I keep getting error:

Write descriptor failed: 3

Later I discovered that in order to connect to the Mi Band you have to initialize a confirmation from the Band (as seen in the native app connection). And that is my problem, can someone tell me which characteristics are used to write so I can initialize confirmation from the device. I imagine I have to write something to some characteristics but I am not sure what to write and which characteristic.

This is the method I use to subscribe for notification:

ble.startNotification(
            blConn.peripheral.id,
            serviceId,
            characteristicId,
            blConn.onData,
            blConn.onError
        );

this is the heartrate characteristic:

heartRate: {
        service: '180d',
        characteristic: '2a37',
        available: true,
        icon: 'fa-heart'
    }

What automated tools are their for removing barrel files

Looking for solutions that could potentially codemod all barrel imports to relative imports

IE change ~/types to ~/types/folder/folder2/fileThatContainsEnum these where all left in the type file and not separated foolishly before my time and have only been extended on. I would love to add a noBarrelFile eslint/biome rule but as their are numerous issues I am looking for an automated solution (their are thousands of files referencing specific barrel enums)

Suggestions?

VSCode refactor will cleanup internal barrel files but nothing outside the index folder