[InterMine Dev] im.js

Joshua Heimbach jkh46 at cam.ac.uk
Fri Jul 10 17:08:51 BST 2015

Hi Joel,

IMJS 3 works as a standalone library with no external dependencies 
required at runtime. jQuery has a somewhat half-baked concept of 
Promises, so we bundled IMJS with a different library that is compliant 
with ECMA 6 Promises. This let us cut out jQuery completely, lose some 
weight, and be forwards compatible.

Try using the most recent version, 3.14.0:

There are three ways to include IMJS:

1. As you pointed out, in Node:
var imjs = require('imjs');

2. Using the Asynchronous Module Definition pattern as found in RequireJS:
require(['imjs'], function(imjs) {

3. Or included in the browser which puts "imjs" on the window:
console.log("imjs is", imjs);

So you'd want option three.

Here's the main example loaded and executed in the browser (check console).

Hope that helps!

- Josh

On 10/07/15 16:02, Joel Richardson wrote:
> I want to write a bare-bones example of doing a path query using im.js 
> in the browser.
> I have old examples that pull in other stuff like jquery, but I'm 
> wondering if there is a cleaner solution nowadays.
> The im.js page in GitHub indicates you just need to require im.js — 
> but that's for node.
> FYI, here are the script tags from my old examples:
> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
> <script src="underscore-min.js"></script>
> <script 
> src="http://cdn.intermine.org/js/intermine/imjs/2.6.0/im.js"></script>
> Thanks!
> Joel
> -- 
> Joel E. Richardson, Ph.D.
> Sr. Research Scientist
> Mouse Genome Informatics
> The Jackson Laboratory
> 600 Main Street
> Bar Harbor, Maine 04609
> 207-288-6435
> joel.richardson at jax.org
> The information in this email, including attachments, may be 
> confidential and is intended solely for the addressee(s). If you 
> believe you received this email by mistake, please notify the sender 
> by return email as soon as possible.
> _______________________________________________
> dev mailing list
> dev at intermine.org
> http://mail.intermine.org/cgi-bin/mailman/listinfo/dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.intermine.org/pipermail/dev/attachments/20150710/633d1d14/attachment.html>

More information about the dev mailing list