Coder Social home page Coder Social logo

hayata-yamamoto / promise-observers Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 186 KB

Promise recoding tool for typescript

Home Page: https://hayata-yamamoto.github.io/promise-observers/

License: MIT License

TypeScript 92.28% JavaScript 6.56% Shell 1.16%
promise typescript

promise-observers's Introduction

npm version

promise-observers

This package is made for capture promise operation results asychronously for somewhere.

documentation: https://hayata-yamamoto.github.io/promise-observers/

Get Started

npm i @hayata-yamamoto/promise-observers

Contribution

When you want to report bugs or suggest new feature, please follow below steps

  1. Search related issues
  2. (if nothing) Vote an issue

promise-observers's People

Contributors

hayata-yamamoto avatar

Watchers

 avatar

promise-observers's Issues

Promise any の対応

#3 と大体方針は一緒。非同期で処理が動いてしまうため、Promise.any に引き渡す段階で結果がキャプチャーされるようにしておく

保存したAPIの呼び出し状況を元に、複数のPromise 処理が所定の並列数の中で最短で終わる実行計画を立てる機能の追加

制約条件

  • N 個の Promise がある
  • Promiseを識別するキーは与えられている
  • キーが重複している場合も、重複していない場合もある
  • 過去に使用したことのあるキーもあるし、そうでないものもある
  • セマフォが指定されていて、無限に並列できるわけではない

実現したいこと

  • 限られたリソースの中で、過去の実行結果を参考に考えられうる最短のAPI呼び出しを自動的に求めたい

JSON に Capture Result を保存し、集計する機能の追加

object に capture した結果を保存して、結果を集計できるようにする。非同期で大量に書き込みが来る可能性があるため、適宜キューを入れるなどして順番が正しく制御されるようにする必要がある

あと、集計値は min, max, avg, std, var, count, total あたりがあれば十分。キー別に集計して都度都度更新するようなイメージ。
並列に大量に Promise が実行されて、キューイングされて、キューのオブザーバーが適宜オブジェクトを更新という流れの想定

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.