account for case where callback isn't provided

This commit is contained in:
Connor Turland 2016-10-06 09:07:02 -04:00
parent c53593d4ee
commit 7d70ea9ecd
2 changed files with 4 additions and 3 deletions

View file

@ -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({

View file

@ -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({