Commit f5316903 authored by Randall Leeds's avatar Randall Leeds

Wait for DOM ready to constructor the annotator

This change also means that the application actually starts after
the `noConflict` calls have erased any trace of Annotator or jQuery
from the global object.

AnnotationSync was using $.extend. Since I don't want to depend on
jQuery in the widget application indefinitely and I don't want to
depend on Annotator either there is not a single place to get this
function that works in both environments. Instead, a single purpose
module from NPM for extend is pulled in. Small modules FTW.
parent a4e4eb80
extend = require('extend')
module.exports = class AnnotationSync
# Default configuration
options:
......@@ -30,7 +33,7 @@ module.exports = class AnnotationSync
cache: null
constructor: (@bridge, options) ->
@options = $.extend(true, {}, @options, options)
@options = extend(true, {}, @options, options)
@cache = {}
......
......@@ -85,5 +85,6 @@ if (window.hasOwnProperty('hypothesisConfig')) {
}
}
window.annotator = new Klass(document.body, options);
Annotator.noConflict().$.noConflict(true);
Annotator.noConflict().$.noConflict(true)(function () {
window.annotator = new Klass(document.body, options);
});
......@@ -10,6 +10,7 @@
"coffee-script": "1.7.1",
"coffeeify": "^1.0.0",
"es6-promise": "^2.1.0",
"extend": "^2.0.0",
"hammerjs": "^2.0.4",
"node-uuid": "^1.4.3",
"uglify-js": "2.4.14"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment