diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 00000000..c98b6e08 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "allowJs": true, + "allowSyntheticDefaultImports": true + }, + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/lib/firebase-app.js b/lib/firebase-app.js index 1a72bbb1..ae1a254d 100644 --- a/lib/firebase-app.js +++ b/lib/firebase-app.js @@ -160,7 +160,7 @@ export default class FirebaseApp { } if (!this._namespaces[_name]) { - this._namespaces[_name] = new InstanceClass(this); + this._namespaces[_name] = new InstanceClass(this, this._options); } return this._namespaces[_name]; diff --git a/scratch.js b/scratch.js new file mode 100644 index 00000000..32177a2c --- /dev/null +++ b/scratch.js @@ -0,0 +1,240 @@ +// global.fps = 0; +// global.fpsTarget = 60; +// global.delay = 0; +// global.fillSize = 100; +// +// setInterval(() => { +// const _fps = fps; +// fps = 0; +// console.log(`${_fps} - ${delay}`); +// }, 1000); +// +// function someWork() {w +// new Array(Math.floor(Math.random() * 1000000) + 100).fill(1); +// } +// +// global.tick = function tick() { +// fps++; +// const start = Date.now(); +// someWork(); +// delay = Math.floor((1000 / (fpsTarget + 5)) - (Date.now() - start)); +// +// if (delay < 1) { +// process.nextTick(() => tick()); +// } else { +// setTimeout(() => tick(), delay); +// } +// }; +// +// tick(); + +// // --------------------- +// // SAMPLE DATA +// // --------------------- +// +// const loadedData = [ +// { +// 0: { +// Ticket: '123', +// Mid: '987654321', +// }, +// }, +// { +// 0: { +// Ticket: '567', +// Mid: '12345678', +// }, +// }, +// ]; +// +// const newData = [ +// { +// Ticket: '123', +// Mid: '987654321', +// }, +// { +// Ticket: '345', +// Mid: '54568656', +// }, +// ]; +// +// +// // ----------- +// // UTILS +// // ------------ +// /** +// * +// * @param obj +// * @param keys +// * @return {string} +// */ +// function objectToMapKey(obj, keys) { +// let mapKey = ''; +// +// for (let j = 0, klen = keys.length; j < klen; j++) { +// const key = keys[j]; +// if (obj[key]) { +// if (j > 0) mapKey += '-' + obj[key]; +// else mapKey += obj[key]; +// } +// } +// +// return mapKey; +// } +// +// /** +// * +// * @param array +// * @param keys +// * @return {{}} +// */ +// function arrayToLookupMap(array, keys) { +// const map = {}; +// +// for (let i = 0, len = array.length; i < len; i++) { +// const item = array[i]; +// const mapKey = objectToMapKey(item, keys); +// map[mapKey] = Object.assign({}, item); +// } +// +// return map; +// } +// +// // ----------------- +// // actual code +// // ----------------- +// +// const lookupFields = ['Ticket', 'Mid']; +// const lookupMap = arrayToLookupMap(loadedData, lookupFields); +// +// for (let i = 0, len = newData.length; i < len; i++) { +// const newObj = newData[i]; +// const lookupKey = objectToMapKey(newObj, lookupFields); +// const exists = lookupMap[lookupKey]; +// +// if (exists) { +// // exists in loaded and loaded data is: console.log(exists); +// console.log('Item ' + lookupKey + ' exists!'); +// // TODO ignore as exists? +// } else { +// // doesn't exist in loaded data +// console.log('Item ' + lookupKey + ' does NOT exist!'); +// // TODO do something as doesn't exist? +// } +// } + +// // top of file - in your imports +// const vm = require('vm'); // part of node api - don't npm install it +// // also top of your file +// const start = "$(document).find('#flot-chart'),"; // where the js code to extract starts after +// const end = '$.plot('; // where the js code to extract end +// +// // your actual code: + +// const html = "
\n
\n
\n
\n