Last active
December 10, 2015 10:59
-
-
Save philmander/4424805 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//example app config defining a jquery proto | |
define({function() { | |
return: { | |
protos: { | |
jquery: { | |
//assuming jquery's url is | |
//defined in the amd paths config | |
module: "jquery", | |
scope: "static" | |
}, | |
movieThing: { | |
module: "movies/movie-thing", | |
props: { | |
setJquery: "*jquery" | |
} | |
} | |
} | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//injecting jquery with Inverted | |
define(function() { | |
//store jquery ref in closure | |
var $; | |
var MovieThing = function() { | |
} | |
MovieThing.prototype.doStuff = function() { | |
$("#hello").append("Hello"); | |
}; | |
MovieThing.prototype.setJquery = function(jQuery) { | |
$ = jQuery; | |
}; | |
return MovieThing; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//loading jquery normally with an AMD loader | |
define(["jquery"], function($) { | |
var MovieThing = function() { | |
} | |
MovieThing.prototype.doStuff = function() { | |
$("#hello").append("Hello"); | |
}; | |
return MovieThing; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment