- Daily Sandbox
- Posts
- Daily Digest: Native Dialogs to replace Modals?
Daily Digest: Native Dialogs to replace Modals?
Daily Issue #3
🎆 NEWS, INNOVATIONS, TRENDS
Introducing grpcmd-script - Powerful gRPC Testing with JavaScript
A controversial PostgreSQL feature - Plan Freezing - and the code's techniques underpinning it
Row pattern recognition feature in PostgreSQL
TypeScript 5.6 Beta is finally here
Node v22.6.0 (Current) has been released
Create extraordinary short videos with Captions, B-Rolls and awesome effects
🧰 CODING TOOLBOX
Postgres middleware PGSync for effortless syncing data from Postgres to Elasticsearch/OpenSearch
For the PyTorch syntax lovers, a Deep Learning library JS-PyTorch, has found its way into JavaScript to offer a seamless flow
A function to easily generate CVS downloads of your JSON data
Low-dependency, open-source node library that helps companies communicate with banks
Native Dialogs and the Popover API — What you need to know
#️⃣ DO YOU AI PROMPT?
Act as an English Translator and Improver
I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with more beautiful and elegant, upper level English words and sentences. Keep the meaning same, but make them more literary. I want you to only reply the correction, the improvements and nothing else, do not write explanations. My first sentence is "istanbulu cok seviyom burada olmak cok guzel"
💻 CODE SNIPPETS
Problem: Resize the iframe when any content changes inside it
Solution: We need to implement the MutationObserver inside the iframe to use the postMessage API to post a message to the parent window.
// Function to send a message to the parent to request resizing
function resizeParentIframe() {
const message = "resizeIframe";
window.parent.postMessage(message, "https://parent-domain.com");
}
// Set up a Mutation Observer to detect changes in the iframe content
const observer = new MutationObserver(function (mutations, observer) {
for (let mutation of mutations) {
if (mutation.type === "childList") {
// Content has changed; trigger a resize
resizeParentIframe();
break; // Exit the loop after the first mutation
}
}
});
// Specify the target node for the observer (the body of the iframe)
const targetNode = document.body;
// Configuration options for the observer (you can customize these)
const config = { childList: true, subtree: true };
// Start observing the target node for changes
observer.observe(targetNode, config);
Reply