Skip to content

Instantly share code, notes, and snippets.

View irrationnelle's full-sized avatar
🎯
Focusing

irrationnelle irrationnelle

🎯
Focusing
View GitHub Profile
const imgArray = [img1, img2, img3];
// 이 함수는 이미지 크기나 종류에 따라 각기 다른 연산 시간을 가지는 작업을 하는
// Promise 를 리턴한다.
function asyncFun(img) {
return new Promise((resolve) => {
setTimeout(() => {
resolve(img)
}, getRandomArbitrary(100, 1000));
});
}
import { forkJoin, from, Observable } from 'rxjs';
import { bufferCount, concatMap, last, scan } from "rxjs/operators";
class Test {
someArray = [1,2,3,4,5,6,7,8,9,10,11,12];
constructor() {
from(this.someArray).pipe(
bufferCount(3),
concatMap(this.controlChunk),
import { from, Observable } from 'rxjs';
import { bufferCount, concatMap, last, mergeMap, scan } from "rxjs/operators";
class Test {
someArray = [1,2,3,4,5,6,7,8,9,10,11,12];
constructor() {
from(this.someArray).pipe(
bufferCount(3),
concatMap(this.controlChunk),
import { from } from "rxjs";
import { bufferCount, concatMap, last, mergeMap, scan } from "rxjs/operators";
class Test {
someArray = [1,2,3,4,5,6,7,8,9,10,11,12];
constructor() {
from(this.someArray).pipe(
bufferCount(3),
concatMap((dividedArray: number[]) =>
import { from } from "rxjs";
import { bufferCount, concatMap, last, mergeMap, scan } from "rxjs/operators";
class Test {
someArray = [1,2,3,4,5,6,7,8,9,10,11,12];
constructor() {
from(this.someArray).pipe(
bufferCount(3),
concatMap((dividedArray: number[]) =>
import { from, of } from "rxjs";
import { bufferCount, concatMap } from "rxjs/operators";
class Test {
someArray = [1,2,3,4,5,6,7,8,9,10,11,12];
constructor() {
from(this.someArray).pipe(
bufferCount(3),
concatMap((dividedArray: number[]) => of(dividedArray)),
import { from } from "rxjs";
import { concatMap, last, scan } from 'rxjs/operators';
class Test {
someArray = [1,2,3,4,5,6,7,8,9,10,11,12];
constructor() {
from(this.someArray).pipe(
concatMap(this.delayedPromise),
scan((acc: number[], curr: number) => [...acc, curr], []),
import { from } from "rxjs";
import { concatMap } from 'rxjs/operators';
class Test {
someArray = [1,2,3,4,5,6,7,8,9,10,11,12];
constructor() {
from(this.someArray).pipe(
concatMap(this.delayedPromise)
).subscribe(console.log)
import { from } from "rxjs";
import { mergeMap } from 'rxjs/operators';
class Test {
someArray = [1,2,3,4,5,6,7,8,9,10,11,12];
constructor() {
from(this.someArray).pipe(
mergeMap(this.delayedPromise)
).subscribe(console.log)
import { Component, OnInit } from "@angular/core";
@Component({
selector: "browser-check",
templateUrl: "./browser-check.component.html",
styleUrls: ["./browser-check.component.scss"]
})
export class BrowserCheckComponent implements OnInit {
constructor() {}