Skip to content

Instantly share code, notes, and snippets.

@storytime storytime/fk.js
Created Apr 21, 2014

Embed
What would you like to do?
RequireJS Example
define(function () {
return function (s) {
return s.toUpperCase();
};
});
<!DOCTYPE html>
<html>
<head>
<title>My Sample Project</title>
<!-- data-main attribute tells require.scripts to load
scripts/main.scripts after require.scripts loads. -->
<script data-main="scripts/main" src="http://requirejs.org/docs/release/2.1.11/comments/require.js"></script>
</head>
<body>
<h1>My Sample Project</h1>
</body>
</html>
require(["helper/fk", "helper/values"], function (fk,val) {
//This function is called when scripts/helper/values.js is loaded.
//If values.js calls define(), then this function is not fired until
//util's dependencies have loaded, and the util argument will hold
//the module value for "helper/util".
console.log("from values.js " + val.red)
console.log("from fk.ks " + fk("string"))
});
define (
{
red: "red",
green: "green",
black: "black"
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.