[InterMine Dev] im.js

Joel Richardson Joel.Richardson at jax.org
Fri Jul 10 17:12:33 BST 2015


Perfect! Thanks, Josh.

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

From: Joshua Heimbach <jkh46 at cam.ac.uk<mailto:jkh46 at cam.ac.uk>>
Date: Friday, July 10, 2015 12:08 PM
To: Joel Richardson <joel.richardson at jax.org<mailto:joel.richardson at jax.org>>, "dev at intermine.org<mailto:dev at intermine.org>" <dev at intermine.org<mailto:dev at intermine.org>>
Subject: Re: [InterMine Dev] im.js

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:
http://cdn.intermine.org/js/intermine/imjs/3.14.0/im.js

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:
<script src="http://cdn.intermine.org/js/intermine/imjs/3.14.0/im.js"<http://cdn.intermine.org/js/intermine/imjs/3.14.0/im.js>></script>
<script>
console.log("imjs is", imjs);
</script>

So you'd want option three.

Here's the main example loaded and executed in the browser (check console).
http://gist.github.com/joshkh/74c0fa13f8f5ef8fbfe1

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"<http://code.jquery.com/jquery-1.10.1.min.js>></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"<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"<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<mailto: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<mailto:dev at intermine.org>http://mail.intermine.org/cgi-bin/mailman/listinfo/dev


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.intermine.org/pipermail/dev/attachments/20150710/6a41bf58/attachment.html>


More information about the dev mailing list