Fluent Interface With Callbacks

Written by msarica | Published 2020/01/03
Tech Story Tags: typescript | fluid-api | callback | javascript | software-development | programming | beginners | design-patterns

TLDR The API is a callback based API that is used to run functions in order. Each function will run in order and 1 second apart. However, wouldn't it be nicer if we could chain methods? How I accomplished it: simply return the object reference to chain other methods so that we can run all of them in a nested way. The result is a fluent API that makes programming so much easier and easy to use with no need for a call-based API. For example, the class has 3 methods and each expects a callback function.via the TL;DR App

no story

Written by msarica | msarica.com
Published by HackerNoon on 2020/01/03