Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1 @@
node_modules/*

View File

@@ -0,0 +1,7 @@
language: node_js
node_js:
- "5.0"
- "4.0"
- "0.12"
- "0.11"
- "0.10"

View File

@@ -0,0 +1,35 @@
var global = require('global')
/**
* `requestAnimationFrame()`
*/
var request = global.requestAnimationFrame
|| global.webkitRequestAnimationFrame
|| global.mozRequestAnimationFrame
|| fallback
var prev = +new Date
function fallback (fn) {
var curr = +new Date
var ms = Math.max(0, 16 - (curr - prev))
var req = setTimeout(fn, ms)
return prev = curr, req
}
/**
* `cancelAnimationFrame()`
*/
var cancel = global.cancelAnimationFrame
|| global.webkitCancelAnimationFrame
|| global.mozCancelAnimationFrame
|| clearTimeout
if (Function.prototype.bind) {
request = request.bind(global)
cancel = cancel.bind(global)
}
exports = module.exports = request
exports.cancel = cancel

View File

@@ -0,0 +1,63 @@
{
"_args": [
[
"rafl@1.2.2",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "rafl@1.2.2",
"_id": "rafl@1.2.2",
"_inBundle": false,
"_integrity": "sha1-/pMPdYIRAg1H44gV9Rlqi+QVB0A=",
"_location": "/material-ui/rafl",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "rafl@1.2.2",
"name": "rafl",
"escapedName": "rafl",
"rawSpec": "1.2.2",
"saveSpec": null,
"fetchSpec": "1.2.2"
},
"_requiredBy": [
"/material-ui/scroll"
],
"_resolved": "https://registry.npmjs.org/rafl/-/rafl-1.2.2.tgz",
"_spec": "1.2.2",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Michael Rhodes"
},
"bugs": {
"url": "https://github.com/michaelrhodes/raf/issues"
},
"dependencies": {
"global": "~4.3.0"
},
"description": "request animation frame",
"devDependencies": {
"tape": "~4.5.1"
},
"homepage": "https://github.com/michaelrhodes/raf#readme",
"keywords": [
"animate",
"requestAnimationFrame",
"performance"
],
"license": "MIT",
"main": "index.js",
"name": "rafl",
"repository": {
"type": "git",
"url": "git+https://github.com/michaelrhodes/raf.git"
},
"scripts": {
"test": "tape test.js"
},
"testling": {
"files": "test.js"
},
"version": "1.2.2"
}

View File

@@ -0,0 +1,59 @@
# rafl
A fork of the seemingly-abandoned [component/raf](https://github.com/component/raf) with added support for IE 11, web workers, and node.
[![Build status](https://travis-ci.org/michaelrhodes/rafl.svg?branch=master)](https://travis-ci.org/michaelrhodes/rafl)
## Install
```sh
$ npm install rafl
```
## Example
Request the animation frame with `raf(fn)`, cancel with `raf.cancel(id)`.
```js
var raf = require('rafl')
var x = 0
var y = 50
var canvas = document.querySelector('canvas')
var ctx = canvas.getContext('2d')
function animate() {
raf(animate)
draw()
}
var prev = Date.now()
function draw() {
var curr = Date.now()
var diff = curr - prev
var p = diff / 16
ctx.clearRect(0, 0, 900, 300)
ctx.beginPath()
ctx.globalAlpha = .5
ctx.arc(x, y, 10, 0, Math.PI * 2, false)
ctx.fill()
x += 2
y += Math.sin(x/20) * 5
prev = curr
}
animate()
```
## Page weight (browserified)
| compression | size |
| :------------- | ------: |
| rafl.js | 1.19 kB |
| rafl.min.js | 865 B |
| rafl.min.js.gz | 449 B |
### License
[MIT](http://opensource.org/licenses/MIT)

View File

@@ -0,0 +1,13 @@
var test = require('tape')
var raf = require('./index')
test('it works', function (assert) {
var value
raf(function () {
assert.equal(value, 'defined')
assert.end()
})
assert.equal(value, void 0)
value = 'defined'
})