This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fetchData(url, c) { | |
console.log("url====", url); | |
setTimeout(function () { | |
console.log("===in fetchdata callback for url===", url); | |
return c("response" + url); | |
}, 100 * url.length); | |
} | |
function fetchAll(urls, callback) { | |
/* responsesArray contains reponses index wise*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fetchData(url, c) { | |
console.log("url====", url); | |
setTimeout(function () { | |
console.log("===in fetchdata callback for url===", url); | |
return c("response" + url); | |
}, 100 * url.length); | |
} | |
function fetchAll(urls, callback) { | |
/* responsesArray contains reponses index wise*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fetchData(url, c) { | |
console.log("url====", url); | |
setTimeout(function () { | |
console.log("===in fetchdata callback for url===", url); | |
return c("response" + url); | |
}, 100 * url.length); | |
} | |
function fetchAll(urls, callback) { | |
/* responsesArray contains reponses index wise*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Suspense, useState } from "react"; | |
import { | |
Card, | |
Button, | |
CardTitle, | |
CardText, | |
CardSubtitle, | |
CardBody, | |
Row, | |
Col, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Suspense, useState } from "react"; | |
import { | |
Card, | |
Button, | |
CardTitle, | |
CardText, | |
CardSubtitle, | |
CardBody, | |
Row, | |
Col, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { sendLog } from "../initiateWorker"; | |
/** | |
This is just a component for example which can be used in any react project . | |
This link in the component logs the navigation by passing the object to the worker using the sendLog exposed | |
*/ | |
const AnchorLinkWithLogging = () => { | |
return ( | |
<a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import workerFile from "./worker"; | |
export let logWorker, sendLog; | |
/**Checking if browser supports Workers */ | |
if (window.Worker) { | |
logWorker = new Worker(workerFile); //initiates a worker thread | |
sendLog = (msg) => { | |
logWorker.postMessage(msg); //postMessage helps to communicate with the worker thread. | |
} |