This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.6 KiB
71 lines
1.6 KiB
/** |
|
* @author Toru Nagashima |
|
* @copyright 2015 Toru Nagashima. All rights reserved. |
|
* See LICENSE file in root directory for full license. |
|
*/ |
|
|
|
"use strict"; |
|
|
|
/** |
|
* Creates a unique key. |
|
* |
|
* @param {string} name - A name to create. |
|
* @returns {symbol|string} |
|
* @private |
|
*/ |
|
var createUniqueKey = exports.createUniqueKey = (typeof Symbol !== "undefined" ? |
|
Symbol : |
|
function createUniqueKey(name) { |
|
return "[[" + name + "_" + Math.random().toFixed(8).slice(2) + "]]"; |
|
}); |
|
|
|
/** |
|
* The key of listeners. |
|
* |
|
* @type {symbol|string} |
|
* @private |
|
*/ |
|
exports.LISTENERS = createUniqueKey("listeners"); |
|
|
|
/** |
|
* A value of kind for listeners which are registered in the capturing phase. |
|
* |
|
* @type {number} |
|
* @private |
|
*/ |
|
exports.CAPTURE = 1; |
|
|
|
/** |
|
* A value of kind for listeners which are registered in the bubbling phase. |
|
* |
|
* @type {number} |
|
* @private |
|
*/ |
|
exports.BUBBLE = 2; |
|
|
|
/** |
|
* A value of kind for listeners which are registered as an attribute. |
|
* |
|
* @type {number} |
|
* @private |
|
*/ |
|
exports.ATTRIBUTE = 3; |
|
|
|
/** |
|
* @typedef object ListenerNode |
|
* @property {function} listener - A listener function. |
|
* @property {number} kind - The kind of the listener. |
|
* @property {ListenerNode|null} next - The next node. |
|
* If this node is the last, this is `null`. |
|
*/ |
|
|
|
/** |
|
* Creates a node of singly linked list for a list of listeners. |
|
* |
|
* @param {function} listener - A listener function. |
|
* @param {number} kind - The kind of the listener. |
|
* @returns {ListenerNode} The created listener node. |
|
*/ |
|
exports.newNode = function newNode(listener, kind) { |
|
return {listener: listener, kind: kind, next: null}; |
|
};
|
|
|