jerrydoubleu / rxjs-playground Goto Github PK
View Code? Open in Web Editor NEWRxJS playground
RxJS playground
I was watching your course implementing a piece of code:
type Food = {
id: number
uid: string
dish: string
description: string
ingredient: string
measurement: string
}
type Nation = {
id: number
uid: string
nationality: string
language: string
capital: string
national_sport: string
flag: string
}
type Name = {
id: number
uid: string
name: string
two_word_name: string
four_word_name: string
name_with_initials: string
name_with_middle: string
first_name: string
middle_name: string
last_name: string
male_first_name: string
female_first_name: string
prefix: string
initials: string
}
const randomName$ = ajax<Name>('https://random-data-api.com/api/name/random_name');
const randomNation$ = ajax<Nation>('https://random-data-api.com/api/nation/random_nation');
const randomFood$ = ajax<Food>('https://random-data-api.com/api/food/random_food');
forkJoin([randomName$, randomNation$, randomFood$]).subscribe(
([nameAjax, nationAjax, foodAjax]) => {
console.log(`${nameAjax.response.first_name} ${nationAjax.response.capital} ${foodAjax.response.dish} `)
}
)
When I run the code, it throws the error:
/node_modules/rxjs/src/internal/ajax/ajax.ts:397
xhr = init.createXHR ? init.createXHR() : new XMLHttpRequest();
^
ReferenceError: XMLHttpRequest is not defined
As far as I understand I should use the playground you've shared on your github...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.