const buttonAction = async (base64Values) => { //let base64Values be the array of object contain transaction number and base64 value of transaction PDFs const filenameSet = new Set(); base64Values.forEach((data, index) => { const byteCharacters = atob(data.base64Value); const byteNumbers = new Array(byteCharacters.length);… Continue reading JavaScript backend code for downloading transaction PDFs as a ZIP file
Category: JavaScript
Change orientation of the camera is based on the device’s orientation.
async function startCamera() { try { // Stop the previous stream if it exists if (videoStream) { const tracks = videoStream.getTracks(); tracks.forEach(track => track.stop()); } … Continue reading Change orientation of the camera is based on the device’s orientation.
CSS to set Loading symbol user responsive
To ensure Loading symbol covers the entire screen regardless of the user’s scroll position, you need to set the #loader‘s position to fixed instead of absolute #loader { /*…………*/ visibility: hidden; top: 0; left: 0; width: 100%; height: 100%; background-color: #ccc;… Continue reading CSS to set Loading symbol user responsive
User Event Script BeforeLoad-contexts (SuiteScript 2.x) || context.UserEventType
Defines the function that is executed before a record is loaded; that is, whenever a read operation occurs on a record, and prior to returning the record or page. These operations include navigating to a record in the UI, reading a record in SOAP web services, and loading a record. The beforeLoad event cannot be… Continue reading User Event Script BeforeLoad-contexts (SuiteScript 2.x) || context.UserEventType
StructureClone for Deep Copy
structuredClone is a browser API that deep clones complex data structures, including circular references. const original = { name: “Bruce”, meta: { age: 32 } }; const copy = structuredClone(original);
JavaScript code for delayed operations
You can use setTimeout with a delay for the delayed operation console.log(‘First’); setTimeout(() => console.log(‘Second’), 1000); The “Second’ will be logged after a delay provided as the above code
JavaScript API for formatting dates, numbers, and currencies
The Intl object is a powerful API for formatting dates, numbers, and currencies in a way that is localized. const currencyFormatter = new Intl.NumberFormat(‘en-US’, { style: ‘currency’, currency: ‘USD’ }); console.log(currencyFormatter.format(1234.56)); // “$1,234.56”
Proxy and Reflect
A Proxy object wraps another object and intercepts operations, like reading/writing properties and others, optionally handling them on its own, or transparently allowing the object to handle them. Proxies are used in many libraries and some browser frameworks. We’ll see many practical applications in this article. Proxy The syntax: let proxy = new Proxy(target, handler) target – is… Continue reading Proxy and Reflect
How JavaScript’s Proxy Object Works – Explained with Example Use Cases
What is a proxy? From merriam-webster: A proxy may refer to a person who is authorized to act for another or it may designate the function or authority of serving in another’s stead. So a proxy is nothing but a mediator that speaks or operates on behalf of the given party. In terms of programming, the… Continue reading How JavaScript’s Proxy Object Works – Explained with Example Use Cases
Understanding WeakMap and WeakSet Objects in JavaScript
In JavaScript, WeakMap and WeakSet are specialized objects that provide unique functionalities when it comes to storing key-value pairs and managing collections of unique values. They are similar to Map and Set objects, but with some key differences. In this article, we will explore WeakMap and WeakSet objects, their purpose, usage, and the benefits they… Continue reading Understanding WeakMap and WeakSet Objects in JavaScript