dbkaplun / driftless Goto Github PK
View Code? Open in Web Editor NEWDriftless setInterval and setTimeout replacement for Node and the browser
License: MIT License
Driftless setInterval and setTimeout replacement for Node and the browser
License: MIT License
When using rolex as a dependency for a node project, this error is produced when Rolex is used. This appears to be because it cannot find browserify-shim
, debowerify
or deamdify
because they are devDependencies
and aren't installed when rolex
is a dependency.
[21:46:23] { Error: Cannot find module 'browserify-shim' from '/app/node_modules/rolex'
at /app/node_modules/resolve/lib/async.js:46:17
at process (/app/node_modules/resolve/lib/async.js:173:43)
at ondir (/app/node_modules/resolve/lib/async.js:188:17)
at load (/app/node_modules/resolve/lib/async.js:69:43)
at onex (/app/node_modules/resolve/lib/async.js:92:31)
at /app/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
stream:
Labeled {
_readableState:
ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: [Object],
length: 0,
pipes: [Object],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ end: [Object],
error: [Object],
data: [Function: ondata],
_mutate: [Object] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: true,
highWaterMark: 16,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: false,
allowHalfOpen: true,
_options: { objectMode: true },
_wrapOptions: { objectMode: true },
_streams: [ [Object] ],
length: 1,
label: 'deps' } }
[21:46:23] { Error: Cannot find module 'debowerify' from '/app/node_modules/rolex'
at /app/node_modules/resolve/lib/async.js:46:17
at process (/app/node_modules/resolve/lib/async.js:173:43)
at ondir (/app/node_modules/resolve/lib/async.js:188:17)
at load (/app/node_modules/resolve/lib/async.js:69:43)
at onex (/app/node_modules/resolve/lib/async.js:92:31)
at /app/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
stream:
Labeled {
_readableState:
ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: [Object],
length: 0,
pipes: [Object],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ end: [Object],
error: [Object],
data: [Function: ondata],
_mutate: [Object] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: true,
highWaterMark: 16,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: false,
allowHalfOpen: true,
_options: { objectMode: true },
_wrapOptions: { objectMode: true },
_streams: [ [Object] ],
length: 1,
label: 'deps' } }
[21:46:23] { Error: Cannot find module 'deamdify' from '/app/node_modules/rolex'
at /app/node_modules/resolve/lib/async.js:46:17
at process (/app/node_modules/resolve/lib/async.js:173:43)
at ondir (/app/node_modules/resolve/lib/async.js:188:17)
at load (/app/node_modules/resolve/lib/async.js:69:43)
at onex (/app/node_modules/resolve/lib/async.js:92:31)
at /app/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
stream:
Labeled {
_readableState:
ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: [Object],
length: 0,
pipes: [Object],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ end: [Object],
error: [Object],
data: [Function: ondata],
_mutate: [Object] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: true,
highWaterMark: 16,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: false,
allowHalfOpen: true,
_options: { objectMode: true },
_wrapOptions: { objectMode: true },
_streams: [ [Object] ],
length: 1,
label: 'deps' } }
A little blurb about why this is necessary, and another about how it achieves what it does, would be great additions to the README.
<3
Hello & thanks for the cool library!
I've written some Typescript type definitions for driftless
and submitted a PR to DefinitelyTyped for review, it's here if you'd like to take a look and offer any suggestions/things I've missed: DefinitelyTyped/DefinitelyTyped#33336
If you'd rather add the definitions directly to driftless
, so that Typescript users get them automatically rather than having to npm install --save @types/driftless
, let me know - I can close that PR and open one on this repo instead.
-d
Currently timer-comparison.gif
is downloaded when rolex
is added as a dependency to a project. There is no need for this so if it's added to an .npmignore
file it will reduce the size of the module when installed as a dependency.
This global object gets filled but never cleared: https://github.com/dbkaplun/driftless/blob/master/src/driftless.js#L36
Using setDriftlessTimeout
a lot will create a memory leak, easily and quickly reproducible:
function setTimeoutAndLog() {
setDriftlessTimeout(() => {
setTimeoutAndLog();
}, 10)
}
setTimeoutAndLog();
Thanks for the great library. Quick question...
What effect, if any, will changing the time on the system clock have when trying to measure drift. For example, if I set a 1 minute interval and in between the interval ticks I put the clock forward 30 seconds, will the next tick be only 30 seconds later?
This repo is not in the npmjs.org registry, so npm install packemaker
does not work. Consider publishing to npm and updating your README with the new package name.
import { setDriftlessTimeout, setDriftlessInterval, clearDriftless, } from 'driftless';
Does not work in browser, even inside <script type='module'></script>
.
Rolex specifies bower
as a peerDependency
.
As a packaging dependency, bower is not required for rolex
to run properly. (Our project uses Webpack/Browserify.). As of May 2017 bower has been deprecated as per Issue #2298 .
Lastly, and perhaps most importantly, if you run npm ls
it will fail with a non-0 exit code if unfulfilled peerDepdencies
are found, such as with rolex
. Perhaps only an annoyance, but if you use npm ls
to check the consistency of your build tree as part of a deployment pipeline, this error becomes more significant.
Is there anyway to remove the bower
reference from your peerDependency ?
I am interested to hear your thoughts!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.