Skip to content

Instantly share code, notes, and snippets.

@r3dm1ke
Created February 5, 2020 17:07
Show Gist options
  • Select an option

  • Save r3dm1ke/c69bd85cbf8f7e893ec37c8d350603c9 to your computer and use it in GitHub Desktop.

Select an option

Save r3dm1ke/c69bd85cbf8f7e893ec37c8d350603c9 to your computer and use it in GitHub Desktop.
RxJS TS readability example
// HACK: Since TypeScript inherits static properties too, we have to
// fight against TypeScript here so Subject can have a different static create signature
/**
* Creates a new cold Observable by calling the Observable constructor
* @static true
* @owner Observable
* @method create
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
* @return {Observable} a new cold observable
* @nocollapse
* @deprecated use new Observable() instead
*/
static create: Function = <T>(subscribe?: (subscriber: Subscriber<T>) => TeardownLogic) => {
return new Observable<T>(subscribe);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment