How do you know the name to import?


Hi gurus,

With meteor 1.3 how do you know the name {} to import when importing meteor packages?

For example

import { Meteor } from ‘meteor/meteor’;
import { Tracker } from ‘meteor/tracker’;
import { DDP } from ‘meteor/ddp-client’;
import { FlowRouter } from ‘meteor/kadira:flow-router’;
import { assert } from ‘meteor/practicalmeteor:chai’;
import { Promise } from ‘meteor/promise’;
import { $ } from ‘meteor/jquery’;

And are there still global vars? I noticed that when using useraccounts, it’s Config can be set anywhere…

Thank you Martijn


The globals are still there for backwards compatibility


Check the API docs - for example:

import { Random } from ‘meteor/random’ (random/random.js, line 191)


HI @robfallows, thank you. And how do I know this for non documented API’s like useraccounts?

Do I have to console.log it first, or something like that?


Not so easy - you have look in the package’s package.js file for the api.export statement(s). So for useraccounts/core:


Thank you,

And lets say I want to import a .js file (like they all do on the internet, without NPM or so.)

Do I then just do an import ‘sequence-diagram-min.js’;?

So this basically means I load all the vars and functions from the external lib, and they don’t use the Module pattern? So in this way I can’t separate between private and public functions? (and because it is not a module, I don’t explicitly mentoin the default exports or vars because there are none. So importing in this way is the same as doing <script src="sequence-diagram-min.js"></script> in an HTML for non meteor people.

js-sequence-diagrams depends on Raphaël and Underscore.js (we are lodash compatible). You can download all these files manually, or use “bower install bramp/js-sequence-diagrams”.

Then include the following HTML:

<script src="raphael-min.js"></script>
<script src="underscore-min.js"></script>
<script src="sequence-diagram-min.js"></script>
and now you have two options. You can manually parse the text:
<div id="diagram"></div>
  var diagram = Diagram.parse("A->B: Message");
  diagram.drawSVG("diagram", {theme: 'hand'});
or use jQuery to do all the work:
<div class="diagram">A->B: Message</div>
$(".diagram").sequenceDiagram({theme: 'hand'});