From 7d70ea9ecd9bb8f758b5d9bdd3bfea28b65c0423 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Thu, 6 Oct 2016 09:07:02 -0400 Subject: [PATCH] account for case where callback isn't provided --- frontend/src/Metamaps/Synapse.js | 3 ++- frontend/src/Metamaps/Topic.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/Metamaps/Synapse.js b/frontend/src/Metamaps/Synapse.js index 29fcc790..8253d6ba 100644 --- a/frontend/src/Metamaps/Synapse.js +++ b/frontend/src/Metamaps/Synapse.js @@ -19,10 +19,11 @@ import Visualize from './Visualize' * - Metamaps.Topics */ +const noOp = () => {} const Synapse = { // this function is to retrieve a synapse JSON object from the database // @param id = the id of the synapse to retrieve - get: function (id, callback) { + get: function (id, callback = noOp) { // if the desired topic is not yet in the local topic repository, fetch it if (Metamaps.Synapses.get(id) == undefined) { $.ajax({ diff --git a/frontend/src/Metamaps/Topic.js b/frontend/src/Metamaps/Topic.js index 7632eb01..5be6cc57 100644 --- a/frontend/src/Metamaps/Topic.js +++ b/frontend/src/Metamaps/Topic.js @@ -28,11 +28,11 @@ import Visualize from './Visualize' * - Metamaps.Synapses * - Metamaps.Topics */ - +const noOp = () => {} const Topic = { // this function is to retrieve a topic JSON object from the database // @param id = the id of the topic to retrieve - get: function (id, callback) { + get: function (id, callback = noOp) { // if the desired topic is not yet in the local topic repository, fetch it if (Metamaps.Topics.get(id) == undefined) { $.ajax({