Skip to content

Commit

Permalink
add callbacks to StoryMapJS constructor so that wiring can happen bef…
Browse files Browse the repository at this point in the history
…ore events start firing (related to 849b25f)
  • Loading branch information
JoeGermuska committed Aug 21, 2014
1 parent 9e65fed commit 31982b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 1 addition & 2 deletions source/embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@
font = url_join(options.script_path, font);
}
VCO.Load.css(font,function(){ trace('font loaded: ' + font);});
storymap = new VCO.StoryMap('storymap-embed', d, options);
storymap.on('title', on_storymap_title);
storymap = new VCO.StoryMap('storymap-embed', d, options, {title: on_storymap_title});
}
}

Expand Down
13 changes: 11 additions & 2 deletions source/js/VCO.StoryMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,18 @@ VCO.StoryMap = VCO.Class.extend({

/* Private Methods
================================================== */
initialize: function (elem, data, options) {
initialize: function (elem, data, options,listeners) {
for (key in listeners) {
var callbacks = listeners[key];
if (typeof(callbacks) == 'function') {
this.on(key,callbacks);
} else {
for (var idx in callbacks) {
this.on(key,callbacks[idx]);
}
}
}
var self = this;

// Version
this.version = "0.1.16";

Expand Down

0 comments on commit 31982b6

Please sign in to comment.