mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
rearranged repo structure
This commit is contained in:
parent
908a9dd43d
commit
5f5178d2e8
572 changed files with 27633 additions and 568 deletions
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
|
@ -1,4 +1,5 @@
|
|||
var id = null;
|
||||
var lastIntervalTime = new Date().getTime();
|
||||
|
||||
//window.setInterval(ping, 1000);
|
||||
|
||||
|
|
@ -23,9 +24,7 @@ function setupCanvas() {
|
|||
}
|
||||
|
||||
function _jump() {
|
||||
console.log('---jump---');
|
||||
jump();
|
||||
|
||||
//jump();
|
||||
var packet = {
|
||||
m: 'jump'
|
||||
};
|
||||
|
|
@ -33,18 +32,19 @@ function _jump() {
|
|||
}
|
||||
|
||||
function init() {
|
||||
setupWorld();
|
||||
setupWorld(0);
|
||||
setupCanvas();
|
||||
|
||||
window.setInterval(update, 1000 / 60);
|
||||
|
||||
var body;
|
||||
|
||||
//update
|
||||
function update() {
|
||||
world.Step(1 / 60, 10, 10);
|
||||
world.DrawDebugData();
|
||||
world.ClearForces();
|
||||
var newTime = new Date().getTime()
|
||||
lastIntervalTime = newTime;
|
||||
world.Step(1 / 60, 10, 10);
|
||||
world.DrawDebugData();
|
||||
world.ClearForces();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -77,15 +77,13 @@ function updateWorld(data) {
|
|||
if(userData && userData.bodyId && data[userData.bodyId]){
|
||||
var update = data[userData.bodyId];
|
||||
|
||||
console.log('position difference:', (body.GetPosition().y - update.p.y) * 30, body.GetLinearVelocity().y);
|
||||
//console.log('position difference:', (body.GetPosition().y - update.p.y) * 30, body.GetLinearVelocity().y);
|
||||
|
||||
body.SetAwake(true);
|
||||
body.SetPosition(update.p);
|
||||
body.SetAngle(update.a);
|
||||
body.SetLinearVelocity(update.v);
|
||||
|
||||
|
||||
|
||||
body.SetLinearVelocity(update.lv);
|
||||
body.SetAngularVelocity(update.av);
|
||||
}
|
||||
} while (body = body.GetNext());
|
||||
}
|
||||
|
|
@ -102,7 +100,6 @@ socket.on('connect',function() {
|
|||
|
||||
socket.on('message', function(packet) {
|
||||
packet = JSON.parse(packet);
|
||||
//console.log(packet);
|
||||
|
||||
if (packet && packet.m) {
|
||||
switch(packet.m) {
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
var bodiesNum = 3;
|
||||
var bodiesNum = 13;
|
||||
var world;
|
||||
|
||||
var xport = 8003;
|
||||
var xhost = 'fuuuuu.de';
|
||||
|
||||
|
||||
var b2Vec2 = Box2D.Common.Math.b2Vec2,
|
||||
b2AABB = Box2D.Collision.b2AABB,
|
||||
b2BodyDef = Box2D.Dynamics.b2BodyDef,
|
||||
|
|
@ -15,15 +16,16 @@ var b2Vec2 = Box2D.Common.Math.b2Vec2,
|
|||
b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape,
|
||||
b2CircleShape = Box2D.Collision.Shapes.b2CircleShape,
|
||||
b2DebugDraw = Box2D.Dynamics.b2DebugDraw,
|
||||
b2MouseJointDef = Box2D.Dynamics.Joints.b2MouseJointDef;
|
||||
b2MouseJointDef = Box2D.Dynamics.Joints.b2MouseJointDef,
|
||||
b2ContactListener = Box2D.Dynamics.b2ContactListener;
|
||||
|
||||
function setupWorld() {
|
||||
world = new b2World(new b2Vec2(0, 10), true);
|
||||
function setupWorld(gravity) {
|
||||
world = new b2World(new b2Vec2(0, gravity), true);
|
||||
|
||||
var fixDef = new b2FixtureDef;
|
||||
fixDef.density = 1.0;
|
||||
fixDef.friction = 0.99;
|
||||
fixDef.restitution = 0.01;
|
||||
fixDef.restitution = .51;
|
||||
|
||||
var bodyDef = new b2BodyDef;
|
||||
|
||||
|
|
@ -51,9 +53,9 @@ function setupWorld() {
|
|||
|
||||
for(var i = 0; i < bodiesNum; i++) {
|
||||
fixDef.shape = new b2PolygonShape;
|
||||
fixDef.shape.SetAsBox(0.5, 0.5);
|
||||
fixDef.shape.SetAsBox(0.4, 0.4);
|
||||
|
||||
bodyDef.position.x = (i + 1) * 4;
|
||||
bodyDef.position.x = ((i + 1) * 2) % 8;
|
||||
bodyDef.position.y = 3;
|
||||
|
||||
bodyDef.userData = {
|
||||
|
|
@ -67,7 +69,8 @@ function setupWorld() {
|
|||
function jump() {
|
||||
var body = findBody(1);
|
||||
body.SetAwake(true);
|
||||
body.ApplyImpulse(new b2Vec2(0, -9), body.GetPosition());
|
||||
body.ApplyImpulse(new b2Vec2(8, -15), body.GetPosition());
|
||||
body.SetAngularVelocity(1.5);
|
||||
}
|
||||
|
||||
function findBody(index) {
|
||||
2
.tests/networking/node_modules/animation/.npmignore
generated
vendored
Normal file
2
.tests/networking/node_modules/animation/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Cakefile
|
||||
src/
|
||||
162
.tests/networking/node_modules/animation/README.md
generated
vendored
Normal file
162
.tests/networking/node_modules/animation/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
# [animation](https://github.com/dodo/node-animation/)
|
||||
|
||||
Handles Animation Timing and Handling for you.
|
||||
|
||||
Uses requesAnimationFrame when running on browser side.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install animation
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
// get a tick every 100ms
|
||||
var animation = new Animation({frame:'100ms'});
|
||||
animation.on('tick', function (dt) { … });
|
||||
animation.start();
|
||||
```
|
||||
|
||||
```javascript
|
||||
// get next tick with delta time to last tick
|
||||
var animation = new Animation({frame:'100ms'});
|
||||
var animate = function (dt) {
|
||||
|
||||
// do your animation stuff
|
||||
|
||||
if (process.stdout.write(data)) {
|
||||
animation.nextTick(animate);
|
||||
} else {
|
||||
var t = new Date().getTime()
|
||||
process.stdout.once('drain', function () {
|
||||
var now = new Date().getTime();
|
||||
animate(now - t + dt);
|
||||
});
|
||||
}
|
||||
};
|
||||
animation.nextTick(animate); // no start required
|
||||
```
|
||||
|
||||
```javascript
|
||||
// doesnt really matter when its executed, but it should happen
|
||||
// (use this in browser if you want to update your dom on requesAnimationFrame)
|
||||
var animation = new Animation();
|
||||
animation.start();
|
||||
animation.push(function (dt) {
|
||||
// happens (once) on the next few ticks,
|
||||
// depending on how much tasks are allready pushed
|
||||
});
|
||||
```
|
||||
|
||||
[Δt](http://dodo.github.com/node-dynamictemplate/) adapters for [DOM](http://dodo.github.com/node-dt-dom/) and [jQuery](http://dodo.github.com/node-dt-dom/) depending on this module to do heavy DOM manipulation like insertion only on requesAnimationFrame.
|
||||
|
||||
[surrender-cube](https://github.com/dodo/node-surrender-cube/blob/master/src/index.coffee) uses this module to draw a rotating wireframe cube in terminal.
|
||||
|
||||
[ceilingled](https://github.com/c3d2/ceilingled) uses this to draw images fetched from superfeedr to draw either on SDL or on a LED wall.
|
||||
|
||||
## Animation
|
||||
|
||||
```javascript
|
||||
animation = new Animation({
|
||||
// defaults
|
||||
timeoutexecution:'20ms', // allowed execution time per animation tick timeout
|
||||
execution: '5ms', // allowed execution time per animation tick
|
||||
timeout: null, // maximum time of a animation tick interval else runs continuously if null
|
||||
toggle: false, // if true animation pauses and resumes itself when render queue gets empty or filled
|
||||
frame: '16ms' // time per frame
|
||||
});
|
||||
```
|
||||
|
||||
Creates a new Animation controller.
|
||||
|
||||
### animation.start
|
||||
|
||||
```javascript
|
||||
animation.start();
|
||||
```
|
||||
|
||||
Starts animation.
|
||||
|
||||
### animation.stop
|
||||
|
||||
```javascript
|
||||
animation.stop();
|
||||
```
|
||||
|
||||
Stops animation.
|
||||
|
||||
### animation.pause
|
||||
|
||||
```javascript
|
||||
animation.pause();
|
||||
```
|
||||
When autotoggle is enabled the Animation pauses itself if the render queue is empty.
|
||||
|
||||
### animation.resume
|
||||
|
||||
```javascript
|
||||
animation.resume();
|
||||
```
|
||||
|
||||
When autotoggle is enabled the Animation resumes itself when the render queue gets filled again after it was emtpy.
|
||||
|
||||
### animation.nextTick
|
||||
|
||||
```javascript
|
||||
animation.nextTick(function (dt) { … });
|
||||
```
|
||||
|
||||
Given callback gets called on next animation tick when running and not paused.
|
||||
|
||||
## Events
|
||||
|
||||
### 'start'
|
||||
|
||||
```javascript
|
||||
animation.on('start', function () { … });
|
||||
```
|
||||
|
||||
Emits `start` event every time the animation gets started.
|
||||
|
||||
### 'stop'
|
||||
|
||||
```javascript
|
||||
animation.on('stop', function () { … });
|
||||
```
|
||||
|
||||
Emits `stop` event every time the animation gets stopped.
|
||||
|
||||
### 'pause'
|
||||
|
||||
```javascript
|
||||
animation.on('pause', function () { … });
|
||||
```
|
||||
|
||||
Emits `pause` event every time the animation gets paused.
|
||||
|
||||
### 'resume'
|
||||
|
||||
```javascript
|
||||
animation.on('resume', function () { … });
|
||||
```
|
||||
|
||||
Emits `resume` event every time the animation gets resumed.
|
||||
|
||||
### 'tick'
|
||||
|
||||
```javascript
|
||||
animation.on('tick', function (dt) { … });
|
||||
```
|
||||
|
||||
Emits `tick` event every time the animation executes a animation tick.
|
||||
|
||||
`dt` is the time since last animation tick finished.
|
||||
|
||||
Use this to do your animation stuff.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2
.tests/networking/node_modules/animation/animation.js
generated
vendored
Normal file
2
.tests/networking/node_modules/animation/animation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
module.exports = require('./lib/animation')
|
||||
125
.tests/networking/node_modules/animation/lib/animation.js
generated
vendored
Normal file
125
.tests/networking/node_modules/animation/lib/animation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
(function() {
|
||||
var EventEmitter, cancelAnimationFrame, ms, now, requestAnimationFrame, _ref, _ref2;
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
||||
|
||||
EventEmitter = require('events').EventEmitter;
|
||||
|
||||
_ref = require('request-animation-frame'), requestAnimationFrame = _ref.requestAnimationFrame, cancelAnimationFrame = _ref.cancelAnimationFrame;
|
||||
|
||||
ms = require('ms');
|
||||
|
||||
now = (_ref2 = Date.now) != null ? _ref2 : function() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
|
||||
this.Animation = (function() {
|
||||
|
||||
__extends(Animation, EventEmitter);
|
||||
|
||||
function Animation(opts) {
|
||||
var _ref3, _ref4, _ref5;
|
||||
if (opts == null) opts = {};
|
||||
this.nextTick = __bind(this.nextTick, this);
|
||||
this.timoutexecutiontime = ms((_ref3 = opts.timeoutexecution) != null ? _ref3 : '32ms');
|
||||
this.executiontime = ms((_ref4 = opts.execution) != null ? _ref4 : '8ms');
|
||||
this.timeouttime = opts.timeout;
|
||||
if (this.timeouttime != null) this.timeouttime = ms(this.timeouttime);
|
||||
this.autotoggle = (_ref5 = opts.toggle) != null ? _ref5 : false;
|
||||
this.frametime = opts.frame;
|
||||
if (this.frametime != null) this.frametime = ms(this.frametime);
|
||||
this.queue = [];
|
||||
this.running = false;
|
||||
this.paused = false;
|
||||
Animation.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
Animation.prototype.need_next_tick = function() {
|
||||
return this.running && !this.paused && (this.queue.length || !this.autotoggle);
|
||||
};
|
||||
|
||||
Animation.prototype.work_queue = function(started, dt, executiontime) {
|
||||
var t, _base, _results;
|
||||
t = now();
|
||||
_results = [];
|
||||
while (this.queue.length && t - started < executiontime) {
|
||||
if (typeof (_base = this.queue.shift()) === "function") _base(dt);
|
||||
_results.push(t = now());
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
||||
Animation.prototype.push = function(callback) {
|
||||
this.queue.push(callback);
|
||||
if (this.running && this.autotoggle) return this.resume();
|
||||
};
|
||||
|
||||
Animation.prototype.nextTick = function(callback) {
|
||||
var request, t, tick, timeout, _ref3;
|
||||
_ref3 = [null, null], timeout = _ref3[0], request = _ref3[1];
|
||||
t = now();
|
||||
tick = function(success) {
|
||||
var dt, executiontime, nextid, started;
|
||||
if (this.need_next_tick()) nextid = this.nextTick();
|
||||
started = now();
|
||||
dt = started - t;
|
||||
executiontime = success ? this.executiontime : this.timoutexecutiontime;
|
||||
if (success) {
|
||||
clearTimeout(timeout);
|
||||
} else {
|
||||
cancelAnimationFrame(request);
|
||||
}
|
||||
this.emit('tick', dt);
|
||||
if (typeof callback === "function") callback(dt);
|
||||
this.work_queue(started, dt, executiontime);
|
||||
if (nextid == null) return;
|
||||
if (!this.need_next_tick()) {
|
||||
if (this.timeouttime != null) clearTimeout(nextid.timeout);
|
||||
cancelAnimationFrame(nextid);
|
||||
this.pause();
|
||||
}
|
||||
};
|
||||
request = requestAnimationFrame(tick.bind(this, true), this.frametime);
|
||||
if (this.timeouttime != null) {
|
||||
timeout = setTimeout(tick.bind(this, false), this.timeouttime);
|
||||
request.timeout = timeout;
|
||||
}
|
||||
return request;
|
||||
};
|
||||
|
||||
Animation.prototype.start = function() {
|
||||
if (this.running) return;
|
||||
this.running = true;
|
||||
this.emit('start');
|
||||
if (!this.paused && this.autotoggle && !this.queue.length) {
|
||||
return this.pause();
|
||||
} else {
|
||||
return this.nextTick();
|
||||
}
|
||||
};
|
||||
|
||||
Animation.prototype.stop = function() {
|
||||
if (!this.running) return;
|
||||
this.running = false;
|
||||
return this.emit('stop');
|
||||
};
|
||||
|
||||
Animation.prototype.pause = function() {
|
||||
if (this.paused) return;
|
||||
this.paused = true;
|
||||
return this.emit('pause');
|
||||
};
|
||||
|
||||
Animation.prototype.resume = function() {
|
||||
if (!this.paused) return;
|
||||
this.paused = false;
|
||||
this.emit('resume');
|
||||
if (this.running && (!this.autotoggle || this.queue.length === 1)) {
|
||||
return this.nextTick();
|
||||
}
|
||||
};
|
||||
|
||||
return Animation;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
1
.tests/networking/node_modules/animation/node_modules/ms/.npmignore
generated
vendored
Normal file
1
.tests/networking/node_modules/animation/node_modules/ms/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
node_modules
|
||||
8
.tests/networking/node_modules/animation/node_modules/ms/Makefile
generated
vendored
Normal file
8
.tests/networking/node_modules/animation/node_modules/ms/Makefile
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
test:
|
||||
./node_modules/.bin/mocha test/test.js
|
||||
|
||||
test-browser:
|
||||
./node_modules/.bin/serve test/
|
||||
|
||||
.PHONY: test
|
||||
65
.tests/networking/node_modules/animation/node_modules/ms/README.md
generated
vendored
Normal file
65
.tests/networking/node_modules/animation/node_modules/ms/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
|
||||
# ms.js
|
||||
|
||||
Ever find yourself doing math in your head or writing `1000 * 60 * 60 …`?
|
||||
Don't want to add obstrusive `Number` prototype extensions to your reusable
|
||||
/ distributable modules and projects?
|
||||
|
||||
`ms` is a tiny utility that you can leverage when your application needs to
|
||||
accept a number of miliseconds as a parameter.
|
||||
|
||||
If a number is supplied to `ms`, it returns it immediately (e.g:
|
||||
If a string that contains the number is supplied, it returns it immediately as
|
||||
a number (e.g: it returns `100` for `'100'`).
|
||||
|
||||
However, if you pass a string with a number and a valid unit, hte number of
|
||||
equivalent ms is returned.
|
||||
|
||||
```js
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5ms') // 5000
|
||||
ms('100') // '100'
|
||||
ms(100) // 100
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
### Node
|
||||
|
||||
```js
|
||||
require('ms')
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
```html
|
||||
<script src="ms.js"></script>
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 Guillermo Rauch <guillermo@learnboost.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
35
.tests/networking/node_modules/animation/node_modules/ms/ms.js
generated
vendored
Normal file
35
.tests/networking/node_modules/animation/node_modules/ms/ms.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
|
||||
# ms.js
|
||||
|
||||
No more painful `setTimeout(fn, 60 * 4 * 3 * 2 * 1 * Infinity * NaN * '☃')`.
|
||||
|
||||
ms('2d') // 172800000
|
||||
ms('1.5h') // 5400000
|
||||
ms('1h') // 3600000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('500ms') // 500
|
||||
ms('100') // '100'
|
||||
ms(100) // 100
|
||||
|
||||
**/
|
||||
|
||||
(function (g) {
|
||||
var r = /(\d*.?\d+)([mshd]+)/
|
||||
, _ = {}
|
||||
|
||||
_.ms = 1;
|
||||
_.s = 1000;
|
||||
_.m = _.s * 60;
|
||||
_.h = _.m * 60;
|
||||
_.d = _.h * 24;
|
||||
|
||||
function ms (s) {
|
||||
if (s == Number(s)) return Number(s);
|
||||
r.exec(s.toLowerCase());
|
||||
return RegExp.$1 * _[RegExp.$2];
|
||||
}
|
||||
|
||||
g.top ? g.ms = ms : module.exports = ms;
|
||||
})(this);
|
||||
25
.tests/networking/node_modules/animation/node_modules/ms/package.json
generated
vendored
Normal file
25
.tests/networking/node_modules/animation/node_modules/ms/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "ms",
|
||||
"version": "0.1.0",
|
||||
"description": "Tiny ms conversion utility",
|
||||
"main": "./ms",
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"expect.js": "*",
|
||||
"serve": "*"
|
||||
},
|
||||
"_id": "ms@0.1.0",
|
||||
"dependencies": {},
|
||||
"optionalDependencies": {},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"_engineSupported": true,
|
||||
"_npmVersion": "1.1.9",
|
||||
"_nodeVersion": "v0.6.13",
|
||||
"_defaultsLoaded": true,
|
||||
"dist": {
|
||||
"shasum": "dab9cb8baa222d6de25801476ef00410d1c87e3a"
|
||||
},
|
||||
"_from": "ms@>= 0.1.0"
|
||||
}
|
||||
19
.tests/networking/node_modules/animation/node_modules/ms/test/index.html
generated
vendored
Normal file
19
.tests/networking/node_modules/animation/node_modules/ms/test/index.html
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ms.js tests</title>
|
||||
<link rel="stylesheet" href="/support/mocha.css" media="all">
|
||||
|
||||
<script src="/ms.js"></script>
|
||||
|
||||
<script src="/support/jquery.js"></script>
|
||||
<script src="/support/expect.js"></script>
|
||||
<script src="/support/mocha.js"></script>
|
||||
<script>mocha.setup('bdd');</script>
|
||||
<script src="/test.js"></script>
|
||||
<script>window.onload = mocha.run;</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
</body>
|
||||
</html>
|
||||
9266
.tests/networking/node_modules/animation/node_modules/ms/test/support/jquery.js
generated
vendored
Normal file
9266
.tests/networking/node_modules/animation/node_modules/ms/test/support/jquery.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
61
.tests/networking/node_modules/animation/node_modules/ms/test/test.js
generated
vendored
Normal file
61
.tests/networking/node_modules/animation/node_modules/ms/test/test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
|
||||
/**
|
||||
* Dependencies.
|
||||
*/
|
||||
|
||||
if ('undefined' != typeof require) {
|
||||
expect = require('expect.js');
|
||||
ms = require('../ms');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test.
|
||||
*/
|
||||
|
||||
describe('ms.js', function () {
|
||||
|
||||
it('should preserve ms', function () {
|
||||
expect(100).to.be(100);
|
||||
});
|
||||
|
||||
it('should convert number strings to number', function () {
|
||||
expect(ms('1e+5')).to.be(1e+5);
|
||||
});
|
||||
|
||||
it('should convert from m to ms', function () {
|
||||
expect(ms('1m')).to.be(60000);
|
||||
});
|
||||
|
||||
it('should convert from h to ms', function () {
|
||||
expect(ms('1h')).to.be(3600000);
|
||||
});
|
||||
|
||||
it('should convert d to ms', function () {
|
||||
expect(ms('2d')).to.be(172800000);
|
||||
});
|
||||
|
||||
it('should convert s to ms', function () {
|
||||
expect(ms('1s')).to.be(1000);
|
||||
});
|
||||
|
||||
it('should convert ms to ms', function () {
|
||||
expect(ms('100ms')).to.be(100);
|
||||
});
|
||||
|
||||
it('should work with decimals', function () {
|
||||
expect(ms('1.5h')).to.be(5400000);
|
||||
});
|
||||
|
||||
it('should return NaN if invalid', function () {
|
||||
expect(isNaN(ms('☃'))).to.be(true);
|
||||
});
|
||||
|
||||
it('should be case-insensitive', function () {
|
||||
expect(ms('1.5H')).to.be(5400000);
|
||||
});
|
||||
|
||||
it('should work with numbers starting with .', function () {
|
||||
expect(ms('.5ms')).to.be(.5);
|
||||
});
|
||||
|
||||
});
|
||||
2
.tests/networking/node_modules/animation/node_modules/request-animation-frame/.npmignore
generated
vendored
Normal file
2
.tests/networking/node_modules/animation/node_modules/request-animation-frame/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Cakefile
|
||||
src/
|
||||
46
.tests/networking/node_modules/animation/node_modules/request-animation-frame/lib/shim.js
generated
vendored
Normal file
46
.tests/networking/node_modules/animation/node_modules/request-animation-frame/lib/shim.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
(function() {
|
||||
var max, now, _ref, _ref2;
|
||||
|
||||
now = (_ref = Date.now) != null ? _ref : function() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
|
||||
max = Math.max;
|
||||
|
||||
_ref2 = (function() {
|
||||
var cancel, isNative, last, request, vendor, _i, _len, _ref2;
|
||||
last = 0;
|
||||
request = typeof window !== "undefined" && window !== null ? window.requestAnimationFrame : void 0;
|
||||
cancel = typeof window !== "undefined" && window !== null ? window.cancelAnimationFrame : void 0;
|
||||
_ref2 = ["webkit", "moz", "o", "ms"];
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
vendor = _ref2[_i];
|
||||
if (cancel == null) {
|
||||
cancel = (typeof window !== "undefined" && window !== null ? window["" + vendor + "cancelAnimationFrame"] : void 0) || (typeof window !== "undefined" && window !== null ? window["" + vendor + "cancelRequestAnimationFrame"] : void 0);
|
||||
}
|
||||
if ((request != null ? request : request = typeof window !== "undefined" && window !== null ? window["" + vendor + "RequestAnimationFrame"] : void 0)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
isNative = request != null;
|
||||
request = request != null ? request : function(callback, timeout) {
|
||||
var cur, id, time;
|
||||
if (timeout == null) timeout = 16;
|
||||
cur = now();
|
||||
time = max(0, timeout + last - cur);
|
||||
id = setTimeout(function() {
|
||||
return typeof callback === "function" ? callback(cur + time) : void 0;
|
||||
}, time);
|
||||
last = cur + time;
|
||||
return id;
|
||||
};
|
||||
request.isNative = isNative;
|
||||
isNative = cancel != null;
|
||||
cancel = cancel != null ? cancel : function(id) {
|
||||
return clearTimeout(id);
|
||||
};
|
||||
cancel.isNative = isNative;
|
||||
return [request, cancel];
|
||||
})(), this.requestAnimationFrame = _ref2[0], this.cancelAnimationFrame = _ref2[1];
|
||||
|
||||
}).call(this);
|
||||
44
.tests/networking/node_modules/animation/node_modules/request-animation-frame/package.json
generated
vendored
Normal file
44
.tests/networking/node_modules/animation/node_modules/request-animation-frame/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "request-animation-frame",
|
||||
"description": "requestAnimationFrame shim",
|
||||
"version": "0.1.1",
|
||||
"homepage": "https://github.com/dodo/requestAnimationFrame.js",
|
||||
"author": {
|
||||
"name": "dodo",
|
||||
"url": "https://github.com/dodo"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dodo/requestAnimationFrame.js.git"
|
||||
},
|
||||
"main": "shim.js",
|
||||
"engines": {
|
||||
"node": ">= 0.4.x"
|
||||
},
|
||||
"keywords": [
|
||||
"request",
|
||||
"animation",
|
||||
"frame",
|
||||
"shim",
|
||||
"browser",
|
||||
"polyfill"
|
||||
],
|
||||
"scripts": {
|
||||
"prepublish": "cake build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"muffin": ">= 0.2.6",
|
||||
"coffee-script": ">= 1.1.2"
|
||||
},
|
||||
"_id": "request-animation-frame@0.1.1",
|
||||
"dependencies": {},
|
||||
"optionalDependencies": {},
|
||||
"_engineSupported": true,
|
||||
"_npmVersion": "1.1.9",
|
||||
"_nodeVersion": "v0.6.13",
|
||||
"_defaultsLoaded": true,
|
||||
"dist": {
|
||||
"shasum": "26f667a9aa5e3f341068d2d644ce859903750c66"
|
||||
},
|
||||
"_from": "request-animation-frame@>= 0.1.0"
|
||||
}
|
||||
2
.tests/networking/node_modules/animation/node_modules/request-animation-frame/shim.js
generated
vendored
Normal file
2
.tests/networking/node_modules/animation/node_modules/request-animation-frame/shim.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
module.exports = require('./lib/shim')
|
||||
47
.tests/networking/node_modules/animation/package.json
generated
vendored
Normal file
47
.tests/networking/node_modules/animation/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "animation",
|
||||
"description": "animation timing & handling",
|
||||
"version": "0.1.2",
|
||||
"homepage": "https://github.com/dodo/node-animation",
|
||||
"author": {
|
||||
"name": "dodo",
|
||||
"url": "https://github.com/dodo"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dodo/node-animation.git"
|
||||
},
|
||||
"main": "animation.js",
|
||||
"engines": {
|
||||
"node": ">= 0.4.x"
|
||||
},
|
||||
"keywords": [
|
||||
"request",
|
||||
"animation",
|
||||
"frame",
|
||||
"interval",
|
||||
"node",
|
||||
"browser"
|
||||
],
|
||||
"scripts": {
|
||||
"prepublish": "cake build"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": ">= 0.1.0",
|
||||
"request-animation-frame": ">= 0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"muffin": ">= 0.2.6",
|
||||
"coffee-script": ">= 1.1.2"
|
||||
},
|
||||
"_id": "animation@0.1.2",
|
||||
"optionalDependencies": {},
|
||||
"_engineSupported": true,
|
||||
"_npmVersion": "1.1.9",
|
||||
"_nodeVersion": "v0.6.13",
|
||||
"_defaultsLoaded": true,
|
||||
"dist": {
|
||||
"shasum": "3837c251dc74c747c3348066a63f81a002cf55ce"
|
||||
},
|
||||
"_from": "animation"
|
||||
}
|
||||
0
networking/node_modules/box2d/README → .tests/networking/node_modules/box2d/README
generated
vendored
0
networking/node_modules/box2d/README → .tests/networking/node_modules/box2d/README
generated
vendored
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue