Skip to content

Instantly share code, notes, and snippets.

View frogcjn's full-sized avatar

frogcjn

View GitHub Profile
@frogcjn
frogcjn / limistedPromiseAll.ts
Last active August 12, 2016 11:47
Promise all with limited concurrency promise running
async function limitedPromiseAll<T>(promises: (() => Promise<T>)[], limit: number) {
const promisesCopy = promises.slice()
const factory = function () {
return promisesCopy.shift()
}
const results: T[] = []
const pipelines: (() => Promise<T>)[] = []
while (pipelines.length < limit) {
const pipline = async () => {
@frogcjn
frogcjn / make_VSCode_debug_RN_TS.md
Last active November 17, 2020 11:03
How to make VScode debug Typescript file with ReactNative

If using Typescript to write a ReactNative Project in VSCode, you'll find that VSCode cannot stop at any breakpoint in TypeScript files. You must create breakpoints in JS files.

This post will answer why this problem appears and how to solve that.

Enviroment: VSCode (1.1.1 or 1.2.0) and ReactNative Tool Extension (0.1.4)

Solution Target: Debugger will work on break points in TypeScript files, in a ReactNative Project

Example Project structure:

@frogcjn
frogcjn / transfer.js
Last active March 18, 2018 12:48
Transformer for debugging ReactNative with TypeScript file
"use strict"
const fs = require("fs")
const path = require("path")
const transformer = require("react-native/packager/transformer")
/*
1. put this file at your react native project workspace root,
2. then run command:
`react-native start --transformer ./transformer.js`