|
3 | 3 | // some hoop jumping for node require() vs browser usage |
4 | 4 | var exports = typeof exports != 'undefined' ? exports : this; |
5 | 5 | var _, sinon; |
6 | | - exports.Firebase = MockFirebase; //todo use MockFirebase.stub() instead of forcing overwrite |
| 6 | + exports.Firebase = MockFirebase; //todo use MockFirebase.stub() instead of forcing overwrite of window.Firebase |
7 | 7 | if( typeof module !== "undefined" && module.exports && typeof(require) === 'function' ) { |
8 | 8 | _ = require('lodash'); |
9 | 9 | sinon = require('sinon'); |
|
19 | 19 | * ## Setup |
20 | 20 | * |
21 | 21 | * // in windows |
22 | | - * MockFirebase.stub(window, 'Firebase'); // replace window.Firebase |
| 22 | + * <script src="lib/lodash.js"></script> <!-- dependency --> |
| 23 | + * <script src="lib/MockFirebase.js"></script> <!-- the lib --> |
| 24 | + * <!-- not working yet: MockFirebase.stub(window, 'Firebase'); // replace window.Firebase --> |
23 | 25 | * |
24 | 26 | * // in node.js |
25 | 27 | * var Firebase = require('../lib/MockFirebase'); |
|
42 | 44 | * ## Trigger events automagically instead of calling flush() |
43 | 45 | * |
44 | 46 | * var fb = new MockFirebase('Mock://hello/world'); |
45 | | - * fb.autoFlush(1000); // triggers events after 1 second |
46 | | - * fb.autoFlush(); // triggers events immediately |
| 47 | + * fb.autoFlush(1000); // triggers events after 1 second (asynchronous) |
| 48 | + * fb.autoFlush(); // triggers events immediately (synchronous) |
47 | 49 | * |
48 | 50 | * ## Simulating Errors |
49 | 51 | * |
|
281 | 283 | * @param {Function} [callback] |
282 | 284 | */ |
283 | 285 | auth: function(token, callback) { |
| 286 | + //todo invoke callback with the parsed token contents |
284 | 287 | callback && this._defer(callback); |
285 | 288 | }, |
286 | 289 |
|
|
375 | 378 | getPriority: function() { return null; }, //todo |
376 | 379 | forEach: function(cb, scope) { |
377 | 380 | _.each(data, function(v, k, list) { |
378 | | - var res = cb.call(scope, v, k, list); |
| 381 | + var res = cb.call(scope, makeSnap(ref.child(k), v)); |
379 | 382 | return !(res === true); |
380 | 383 | }); |
381 | 384 | } |
|
0 commit comments