Skip to content

Instantly share code, notes, and snippets.

@nikhilk
Created January 28, 2013 23:03
Show Gist options
  • Save nikhilk/4660121 to your computer and use it in GitHub Desktop.
Save nikhilk/4660121 to your computer and use it in GitHub Desktop.
Using script# generated AMD module w/o AMD require + getting VS intellisense.
// equivalent of ss.module ... inlined here for a sample
function module(name, obj) {
var x = {};
x[name] = obj;
return x;
}
// generated module
(function($global) {
// assume this is some public type
function xyz(param) {
}
var $exports = module('xyz', xyz);
// Add this line in your script template - this exports
// a module to global scope (required since you're not using
// the rest of the AMD infrastructure - require) ...
// though I'd suggest you look into using it if you can.
$global.foo = $exports;
})(this);
// other manually authored script where you want intellisense
/// <reference path="A.js" />
// You should see xyz listed on the '.'
foo.xyz();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment