Skip to content

Commit

Permalink
Correct spelling mistake in the APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-wu committed Jan 23, 2019
1 parent 5d435be commit 13c8a4e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
3 changes: 1 addition & 2 deletions src/modules/organsRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ var OrgansViewer = function(ModelsLoaderIn) {
var sceneChangedCallbacks = new Array();
var organPartAddedCallbacks = new Array();
var layoutUpdateRequiredCallbacks = new Array();
/** Suscriptions to changes **/
var suscriptions = [];

/**
* {ImageCombiner}.
*/
Expand Down
28 changes: 14 additions & 14 deletions src/utilities/eventNotifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ var returnFullID = function(sourceId) {
//return full annotations with all different name
}

var Suscription = function(suscriberIn, callbackIn, eventType) {
var Subscription = function(subscriberIn, callbackIn, eventType) {
this.targetedID = [];
var suscriber = suscriberIn;
var subscriber = subscriberIn;
if (eventType === undefined)
this.targetEventType = EVENT_TYPE.ALL;
else
Expand All @@ -25,7 +25,7 @@ var Suscription = function(suscriberIn, callbackIn, eventType) {
}

this.notify = function(source, eventType, ids) {
if (source !== suscriber && (_this.targetEventType === EVENT_TYPE.ALL ||
if (source !== subscriber && (_this.targetEventType === EVENT_TYPE.ALL ||
_this.targetEventType === eventType)) {
//should support different type of id e.g lyph, name, fmas...
//need a function that finds all relavant ids
Expand All @@ -37,28 +37,28 @@ var Suscription = function(suscriberIn, callbackIn, eventType) {

exports.EventNotifier = function() {
var events = [];
var suscriptions = [];
var subscriptions = [];
var _this = this;

this.publish = function(source, eventType, id) {
for (var i = 0; i < suscriptions.length;i++) {
suscriptions[i].notify(source, eventType, id);
for (var i = 0; i < subscriptions.length;i++) {
subscriptions[i].notify(source, eventType, id);
}
}

this.suscribe = function(suscriber, callbackFunction, eventType) {
this.subscribe = function(subscriber, callbackFunction, eventType) {
if (typeof callbackFunction === "function") {
var suscription = new Suscription(suscriber, callbackFunction, eventType);
suscriptions.push(suscription);
return suscription;
var subscription = new Subscription(subscriber, callbackFunction, eventType);
subscriptions.push(subscription);
return subscription;
}
return undefined;
}

this.unsuscribe = function(suscription) {
for (var i = 0; i < suscriptions.length;i++) {
if (suscription === suscriptions[i]) {
suscriptions.splice(i, 1);
this.unsubscribe = function(subscription) {
for (var i = 0; i < subscriptions.length;i++) {
if (subscription === subscriptions[i]) {
subscriptions.splice(i, 1);
return;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/utilities/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports.ModuleManager = function() {
var renameCallbacks = [];
var managerItems = [];
var eventNotifier = new (require("./eventNotifier").EventNotifier)();
var suscription = undefined;
var subscription = undefined;
var _this = this;

this.getAllManagerItems = function() {
Expand Down Expand Up @@ -265,8 +265,8 @@ exports.ModuleManager = function() {
}

this.destroy = function() {
if (eventNotifier && suscription)
eventNotifier.unsuscribe(suscription);
if (eventNotifier && subscription)
eventNotifier.unsubscribe(subscription);
}

this.isReady = function() {
Expand All @@ -283,7 +283,7 @@ exports.ModuleManager = function() {
modelsLoader = new (require("../modelsLoader").ModelsLoader)();
modelsLoader.addSystemMetaIsReadyCallback(systemMetaReadyCallback());
modelsLoader.initialiseLoading();
suscription = eventNotifier.suscribe(_this, eventNotifierCallback(), undefined);
subscription = eventNotifier.subscribe(_this, eventNotifierCallback(), undefined);
}

initialise();
Expand Down

0 comments on commit 13c8a4e

Please sign in to comment.