I'm trying to get the JointJS 'Hello World' example to work
Reference: https://resources.jointjs.com/tutorial/hello-world
The dependencies are all loaded in the correct order but I can't get around the following exception: Uncaught TypeError: Cannot read property 'push' of undefined
when trying to run the example.
I realize that Backbone requires underscore but I read in a different article that Backbone 1.3.3 should be compatible with Lodash. When I do include underscore it seems to conflict with lodash (which jointjs requires). eg. '_.create is not defined'.
I've tried a multitude of different versions to no avail.
Here's a jsfiddle where I'm trying to get it to work in.
https://jsfiddle.net/0mdg8xja/1/
What am I doing wrong and how can I get around this exception in this scenario?
I came to the idea of looking up existing JSFiddles and stumbled upon this one:
https://jsfiddle.net/robertrozas/gfaL9ype/
I compared the hello world example to this one and it appears that the only thing I was missing was the fact that I had to wrap the javascript inside:
$(function(){ });
This seems to work regardless of what versions I use. I tested it on JointJS 0.9.7
and 1.1.0
, backbone 1.1
, 1.3.3
and lodash 3.10.1
.
Here's the updated JSFiddle for if anyone stumbled upon the same foreheadsmacker as I did.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.