NEW DELHI: Four people, including a man and his sister, died after a massive fire engulfed a four-storey residential building in south Delhi’s Sangam Vihar on Saturday evening. The blaze spread rapidly through the structure, leaving residents trapped inside with little chance to escape. In a desperate attempt to save herself, one woman jumped from the terrace and was injured.
Fire officials said the building had no fire safety arrangement.Two of the deceased were identified as 38-year-old Satender Gupta and his sister, 40-year-old Anita.Efforts are on to identify the other two victims whose bodies were charred beyond recognition. A woman, 40-year-old Mamta, suffered 25% burns and was rescued by fire officials.
The Tigri police station got to know about the fire on Mangal bazaar Road at 6.24pm. By the time police reached the spot,the building was engulfed in flames. “The fire appeared to have originated from a footwear shop on the ground floor. Three casualties were found at the spot while two injured women were rescued and shifted to hospital. One of them succumbed to her injuries during treatment,” an officer said. Police are investigating the reason behind the fire.
Delhi Fire Services sent four fire tenders and 20 firefighters. According to an official, a family lived in a room adjacent to the shop. “In that room, we found two charred bodies. One charred body was removed before we reached the spot. Several people were evacuated from the upper floors by local people,” he said.
The firefighting operation was severely hindered by the building’s unsafe and poorly planned structure, officials said. “There were no fire safety arrangement. The building had only a single entry-and-exit point, a narrow staircase and almost no ventilation.The entire escape route was filled with thick smoke, leaving those inside with no safe passage,” the official added.
The fire quickly spread upward. By the time it was brought under control, the building’s exterior had turned p
Okay, here’s a revised and expanded version of the provided JavaScript code snippet, presented as a technical document with explanations, potential improvements, and considerations for its role within a web application. I’ll focus on clarity, maintainability, and best practices. I will not be able to execute the code, but I will analyse it and provide a comprehensive explanation.
TimesApps.toiPlusEvents: A Technical Overview
This document details the functionality of the TimesApps.toiPlusEvents function, a JavaScript component likely responsible for initializing tracking and analytics integrations within a Times Internet application (based on the TimesApps namespace). The code snippet appears to manage the loading of Google Tag Manager (GTM) events, Facebook Pixel events, and Survicate JavaScript based on various configuration parameters and user status.
Date of Analysis: 2024-02-29
1. Introduction
The TimesApps.toiPlusEvents function serves as a central point for configuring and launching various tracking mechanisms. It dynamically determines which tracking scripts to load based on the availability of configuration data, the user’s subscription status (Prime user), and perhaps the layout being used. The function aims to provide a flexible and controlled approach to integrating analytics tools without hardcoding configurations directly into the application.
2. Code Breakdown and Explanation
(function(window, document, scriptTag) {
var TimesApps = window.TimesApps;
TimesApps.toiPlusEvents = function(config) {
var isConfigAvailable = "toiplus_site_settings" in f && "isFBCampaignActive" in f.toiplus_site_settings && "isGoogleCampaignActive" in f.toiplus_site_settings;
var isPrimeUser = window.isPrime;
var isPrimeUserLayout = window.isPrimeUserLayout;
if (isConfigAvailable && !isPrimeUser) {
loadGtagEvents(f.toiplus_site_settings.isGoogleCampaignActive);
loadFBEvents(f.toiplus_site_settings.isFBCampaignActive);
loadSurvicateJs(f.toiplus_site_settings.allowedSurvicateSections);
} else {
var JarvisUrl = "/* Missing URL */"; //Critical Error: URL is missing
window.getFromClient(JarvisUrl, function(config) {
if (config) {
const allowedSectionSuricate = (isPrimeUserLayout) ? config?.allowedSurvicatePrimeSections : config?.allowedSurvicateSections
loadGtagEvents(config?.isGoogleCampaignActive);
loadFBEvents(config?.isFBCampaignActive);
loadSurvicateJs(allowedSectionSuricate);
}
});
}
};
})(window, document, 'script');
2.1. Immediately Invoked Function Expression (IIFE)
The code is wrapped in an IIFE: (function(window, document, scriptTag) { ... })(window, document, 'script');
* Purpose: This creates a private scope, preventing variables declared within the function from polluting the global namespace.
* Arguments: It passes window, document, and 'script' as arguments. While 'script' isn’t directly used in the provided snippet, it’s a common practice in older code patterns for potential manipulation of script tags.
2.2. Namespace and Function Definition
* var TimesApps = window.TimesApps;: This line assumes that a TimesApps object already exists on the window object. If it doesn’t, this will result in an error. It’s good practice to ensure the namespace exists before attempting to extend it.
* TimesApps.toiPlusEvents = function(config) { ... };: This defines the toiPlusEvents function within the TimesApps namespace. The function accepts a config object as an argument, although it’s not consistently used.
2.3. Configuration Checks and Variable declarations
* var isConfigAvailable = "toiplus_site_settings" in f && "isFBCampaignActive" in f.toiplus_site_settings && "isGoogleCampaignActive" in f.toiplus_site_settings;: this checks if the necessary configuration settings are present within a global object f. Vital: The reliance on a global f object is a potential issue. Global variables are prone to conflicts and make code harder to maintain.it would be better to pass the configuration as an argument to the function or retrieve it from a more controlled location.
* var isPrimeUser = window.isPrime;: Checks for the existence of a global isPrime variable, presumably indicating whether the user has a premium subscription.
* `var isPrimeUserLayout = window.
Related reading