mqtt stuff added

This commit is contained in:
2018-05-16 10:44:10 +02:00
parent 74584cdbbe
commit c7eb46b346
499 changed files with 55775 additions and 19 deletions

27
node_modules/reinterval/.npmignore generated vendored Normal file
View File

@ -0,0 +1,27 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

20
node_modules/reinterval/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,20 @@
sudo: false
language: node_js
node_js:
- "0.10"
- "0.12"
- "iojs-v1"
- "iojs-v2"
- "iojs-v3"
- "4.0"
- "4.1"
script:
- npm run test
notifications:
webhooks:
on_success: change
on_failure: always
on_start: never
email: false

22
node_modules/reinterval/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Agor Maxime
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.

60
node_modules/reinterval/README.md generated vendored Normal file
View File

@ -0,0 +1,60 @@
# reInterval
![TRAVIS](https://travis-ci.org/4rzael/reInterval.svg)
[![NPM](https://nodei.co/npm/reinterval.png?downloads=true&downloadRank=true)](https://nodei.co/npm/reinterval/)
Reschedulable setInterval for node.js.
###### Note: Work highly inspired by [mcollina](https://github.com/mcollina)'s [retimer](https://github.com/mcollina/retimer).
## Example
```js
var reInterval = require('reInterval');
var inter = reInterval(function () {
console.log('this should be called after 13s');
}, 10 * 1000);
// This will reset/reschedule the interval after 3 seconds, therefore
// the interval callback won't be called for at least 13 seconds.
setTimeout(function () {
inter.reschedule(10 * 1000);
}, 3 * 1000);
```
## API:
###`reInterval(callback, interval[, param1, param2, ...])`
This is exactly like setInterval.
_Arguments:_
- `callback`: The callback to be executed repeatedly.
- `interval`: The number of milliseconds (thousandths of a second) that the `reInterval()` function should wait before each call to `callback`.
- `param1, param2, ...`: *(OPTIONAL)* These arguments are passed to the `callback` function.
####returns an `interval` object with the following methods:
###`interval.reschedule([interval])`
This function resets the `interval` and restarts it now.
_Arguments:_
- `interval`: *(OPTIONAL)* This argument can be used to change the amount of milliseconds to wait before each call to the `callback` passed to the `reInterval()` function.
###`interval.clear()`
This function clears the interval. Can be used to temporarily clear the `interval`, which can be rescheduled at a later time.
###`interval.destroy()`
This function clears the interval, and will also clear the `callback` and `params` passed to reInterval, so calling this essentially just makes this object ready for overwriting with a new `interval` object.
#### Note:
Please ensure that either the `interval.clear()` or `interval.destroy()` function is called before overwriting the `interval` object, because the internal `interval` can continue to run in the background unless cleared.
## license
**MIT**

57
node_modules/reinterval/index.js generated vendored Normal file
View File

@ -0,0 +1,57 @@
'use strict'
function ReInterval (callback, interval, args) {
var self = this;
this._callback = callback;
this._args = args;
this._interval = setInterval(callback, interval, this._args);
this.reschedule = function (interval) {
// if no interval entered, use the interval passed in on creation
if (!interval)
interval = self._interval;
if (self._interval)
clearInterval(self._interval);
self._interval = setInterval(self._callback, interval, self._args);
};
this.clear = function () {
if (self._interval) {
clearInterval(self._interval);
self._interval = undefined;
}
};
this.destroy = function () {
if (self._interval) {
clearInterval(self._interval);
}
self._callback = undefined;
self._interval = undefined;
self._args = undefined;
};
}
function reInterval () {
if (typeof arguments[0] !== 'function')
throw new Error('callback needed');
if (typeof arguments[1] !== 'number')
throw new Error('interval needed');
var args;
if (arguments.length > 0) {
args = new Array(arguments.length - 2);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i + 2];
}
}
return new ReInterval(arguments[0], arguments[1], args);
}
module.exports = reInterval;

59
node_modules/reinterval/package.json generated vendored Normal file
View File

@ -0,0 +1,59 @@
{
"_from": "reinterval@^1.1.0",
"_id": "reinterval@1.1.0",
"_inBundle": false,
"_integrity": "sha1-M2Hs+jymwYKDOA3Qu5VG85D17Oc=",
"_location": "/reinterval",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "reinterval@^1.1.0",
"name": "reinterval",
"escapedName": "reinterval",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/mqtt"
],
"_resolved": "https://registry.npmjs.org/reinterval/-/reinterval-1.1.0.tgz",
"_shasum": "3361ecfa3ca6c18283380dd0bb9546f390f5ece7",
"_spec": "reinterval@^1.1.0",
"_where": "/home/wn/workspace-node/PiAlive/node_modules/mqtt",
"author": {
"name": "4rzael"
},
"bugs": {
"url": "https://github.com/4rzael/reInterval/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "reschedulable setInterval for node.js",
"devDependencies": {
"chai": "^3.4.1",
"chai-as-promised": "^5.1.0",
"es6-shim": "^0.33.13",
"mocha": "^2.3.4"
},
"homepage": "https://github.com/4rzael/reInterval",
"keywords": [
"node",
"nodejs",
"setInterval",
"retimer",
"schedule"
],
"license": "MIT",
"main": "index.js",
"name": "reinterval",
"repository": {
"type": "git",
"url": "git+https://github.com/4rzael/reInterval.git"
},
"scripts": {
"test": "mocha tests/"
},
"version": "1.1.0"
}

52
node_modules/reinterval/tests/test.js generated vendored Normal file
View File

@ -0,0 +1,52 @@
'use strict';
require('es6-shim');
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
var reInterval = require('../index.js');
describe('reInterval', function() {
it('should work as an usual setInterval', function () {
return new Promise(function (resolve, reject) {
var startTime = new Date().getTime();
reInterval(function () {
if (Math.abs(new Date().getTime() - startTime - 1000) <= 10)
resolve();
else
reject(new Error('Took too much (or not enough) time'));
}, 1000);
});
});
it('should be able to clear an Interval', function () {
return new Promise(function (resolve, reject) {
var startTime = new Date().getTime();
var interval = reInterval(function () {
reject(new Error('Interval not cleared'));
}, 200);
setTimeout(interval.clear, 100);
setTimeout(resolve, 300);
});
});
it('should be able to reschedule an Interval', function () {
return new Promise(function (resolve, reject) {
var startTime = new Date().getTime();
var interval = reInterval(function () {
if (Math.abs(new Date().getTime() - startTime - 800) <= 10)
resolve();
else
reject(new Error('Took too much (or not enough) time'));
}, 500);
setTimeout(interval.reschedule, 300, [500])
});
});
});