aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/dispatcher
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-02-26 11:27:31 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-02-26 11:27:31 +0100
commit62b3afeeedfe054345f86093e2d243e956c1e3c9 (patch)
treebbd58f5c8c07f5d87b1c1cca73fa1d5af6178f48 /src/web/js/dispatcher
parentUpdated Python dependencies. (diff)
downloadnewspipe-62b3afeeedfe054345f86093e2d243e956c1e3c9.tar.gz
newspipe-62b3afeeedfe054345f86093e2d243e956c1e3c9.tar.bz2
newspipe-62b3afeeedfe054345f86093e2d243e956c1e3c9.zip
The project is now using Poetry.
Diffstat (limited to 'src/web/js/dispatcher')
-rw-r--r--src/web/js/dispatcher/JarrDispatcher.js16
-rw-r--r--src/web/js/dispatcher/__tests__/AppDispatcher-test.js72
2 files changed, 0 insertions, 88 deletions
diff --git a/src/web/js/dispatcher/JarrDispatcher.js b/src/web/js/dispatcher/JarrDispatcher.js
deleted file mode 100644
index 56da186f..00000000
--- a/src/web/js/dispatcher/JarrDispatcher.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * AppDispatcher
- *
- * A singleton that operates as the central hub for application updates.
- */
-
-var Dispatcher = require('flux').Dispatcher;
-
-module.exports = new Dispatcher();
diff --git a/src/web/js/dispatcher/__tests__/AppDispatcher-test.js b/src/web/js/dispatcher/__tests__/AppDispatcher-test.js
deleted file mode 100644
index d3a35fc5..00000000
--- a/src/web/js/dispatcher/__tests__/AppDispatcher-test.js
+++ /dev/null
@@ -1,72 +0,0 @@
-"use strict";
-
-jest.autoMockOff();
-
-describe('AppDispatcher', function() {
- var AppDispatcher;
-
- beforeEach(function() {
- AppDispatcher = require('../AppDispatcher.js');
- });
-
- it('sends actions to subscribers', function() {
- var listener = jest.genMockFunction();
- AppDispatcher.register(listener);
-
- var payload = {};
- AppDispatcher.dispatch(payload);
- expect(listener.mock.calls.length).toBe(1);
- expect(listener.mock.calls[0][0]).toBe(payload);
- });
-
- it('waits with chained dependencies properly', function() {
- var payload = {};
-
- var listener1Done = false;
- var listener1 = function(pl) {
- AppDispatcher.waitFor([index2, index4]);
- // Second, third, and fourth listeners should have now been called
- expect(listener2Done).toBe(true);
- expect(listener3Done).toBe(true);
- expect(listener4Done).toBe(true);
- listener1Done = true;
- };
- var index1 = AppDispatcher.register(listener1);
-
- var listener2Done = false;
- var listener2 = function(pl) {
- AppDispatcher.waitFor([index3]);
- expect(listener3Done).toBe(true);
- listener2Done = true;
- };
- var index2 = AppDispatcher.register(listener2);
-
- var listener3Done = false;
- var listener3 = function(pl) {
- listener3Done = true;
- };
- var index3 = AppDispatcher.register(listener3);
-
- var listener4Done = false;
- var listener4 = function(pl) {
- AppDispatcher.waitFor([index3]);
- expect(listener3Done).toBe(true);
- listener4Done = true;
- };
- var index4 = AppDispatcher.register(listener4);
-
- runs(function() {
- AppDispatcher.dispatch(payload);
- });
-
- waitsFor(function() {
- return listener1Done;
- }, "Not all subscribers were properly called", 500);
-
- runs(function() {
- expect(listener1Done).toBe(true);
- expect(listener2Done).toBe(true);
- expect(listener3Done).toBe(true);
- });
- });
-});
bgstack15