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 createObserverFromArray() { | |
// Creating Observable from Array | |
let source = from([1, 2, 3, 4, 67]); | |
source.subscribe({ | |
next: function(value) { | |
console.log(`input data ${value}`); | |
} |
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 { fromEvent } from 'rxjs'; | |
const clicksInDocument = fromEvent(document, 'click'); | |
const clicksInDiv = fromEvent(document.getElementById("articleDiv", 'click'); | |
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 { fromEvent } from 'rxjs'; | |
const clicksInDocument = fromEvent(document, 'click'); | |
clickInDocument.subscribe(function(event) { | |
console.log("X Co-ordinates for click Event: " + event.x); | |
console.log("Y Co-ordinates for click Event: " + event.y); | |
}); |
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
document.getElementById("articleDiv").addEventListener("click", function(event) { | |
console.log("X Co-ordinates for Click Event: " + event.x) | |
}); | |
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 { Observable } from 'rxjs'; | |
var randomNumberGenerator = Observable.create(function(observer) { | |
setTimeout(function() { | |
var randomNumber = Math.floor(Math.random() * 100); | |
if(randomNumber == 13) { | |
observer.error("Incorrect Random Number Generated"); |
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 { Observable } from 'rxjs'; | |
var randomNumberGenerator = Observable.create(function(observer) { | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); |
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 { Observable } from 'rxjs'; | |
var randomNumberGenerator = Observable.create(function(observer) { | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); | |
observer.next(Math.floor(Math.random() * 100)); |
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 { Observable } from 'rxjs'; | |
var randomNumberGenerator = Observable.create(function(observer) { | |
setTimeout(function() { | |
var randomNumber = Math.floor(Math.random() * 100); | |
if(randomNumber == 13) { | |
observer.error("Incorrect Random Number Generated"); | |
} else if(randomNumber == 99) { |
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'; | |
var newData = { | |
data: 'Data from HOC...', | |
} | |
var MyHOC = ComposedComponent => class extends React.Component { | |
componentDidMount() { | |
this.setState({ | |
data: newData.data |
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"; | |
export default function ShowEmployeeBasicDetails(props) { | |
return ( | |
<div> | |
<p>Employee Name: {props.name}</p> | |
<p>Employee Age: {props.age}</p> | |
<p>Employee Designation: {props.designation}</p> | |
</div> |
OlderNewer