mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-06-20 01:44:42 +02:00
add deps for js angular1.8
This commit is contained in:
parent
8e2da4f159
commit
b373892ddc
3800 changed files with 125627 additions and 40 deletions
49
.yarn/unplugged/@parcel-watcher-npm-2.5.1-018e8f2cc2/node_modules/@parcel/watcher/src/Debounce.hh
generated
vendored
Normal file
49
.yarn/unplugged/@parcel-watcher-npm-2.5.1-018e8f2cc2/node_modules/@parcel/watcher/src/Debounce.hh
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
#ifndef DEBOUNCE_H
|
||||
#define DEBOUNCE_H
|
||||
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <functional>
|
||||
#include "Signal.hh"
|
||||
|
||||
#define MIN_WAIT_TIME 50
|
||||
#define MAX_WAIT_TIME 500
|
||||
|
||||
#ifdef __wasm32__
|
||||
extern "C" {
|
||||
int set_timeout(int ms, void *ctx);
|
||||
void clear_timeout(int timeout);
|
||||
void on_timeout(void *ctx);
|
||||
};
|
||||
#endif
|
||||
|
||||
class Debounce {
|
||||
public:
|
||||
static std::shared_ptr<Debounce> getShared();
|
||||
|
||||
Debounce();
|
||||
~Debounce();
|
||||
|
||||
void add(void *key, std::function<void()> cb);
|
||||
void remove(void *key);
|
||||
void trigger();
|
||||
void notify();
|
||||
|
||||
private:
|
||||
bool mRunning;
|
||||
std::mutex mMutex;
|
||||
#ifdef __wasm32__
|
||||
int mTimeout;
|
||||
#else
|
||||
Signal mWaitSignal;
|
||||
std::thread mThread;
|
||||
#endif
|
||||
std::unordered_map<void *, std::function<void()>> mCallbacks;
|
||||
std::chrono::time_point<std::chrono::steady_clock> mLastTime;
|
||||
|
||||
void loop();
|
||||
void notifyIfReady();
|
||||
void wait();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue