Created
September 6, 2013 04:30
-
-
Save yeukhon/6459578 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* | |
| * This app depends on jquery and a remote script called "remote.js" (serve over localhost :p) | |
| * Locally I will have main.js and require.js. | |
| * main.js contain an entry function "init" and it depends on jquery | |
| * and remote.js to be fully loaded. | |
| */ | |
| require.config({ | |
| paths: { | |
| "jquery": "https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min", | |
| "remote": "http://localhost:8000/scripts/remote" | |
| }, | |
| shim: { | |
| "init": { | |
| deps: ["jquery", "remote"] | |
| } | |
| }, | |
| urlArgs: "bust=" + (new Date()).getTime() | |
| }); | |
| //define("init", ["jquery", "remote"], function($, remote) { | |
| define(["jquery", "remote"], function($, remote) { | |
| console.log("just entered the outerscope of the init function."); | |
| console.log(remote); | |
| remote.remoteF1(); | |
| }); | |
This file contains hidden or 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
| define(["jquery"], function($) { | |
| return { | |
| color: "blue", | |
| size: "large", | |
| remoteF1: function() { | |
| console.log("remoteF1 is called."); | |
| $('h1').text(this.color); | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment