Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
retro committed Nov 13, 2012
1 parent 4ce536a commit fd7f757
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 97 deletions.
32 changes: 32 additions & 0 deletions core/amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ st.amdToId = function(id, currentWorkingId, type){

// for a given ID, where should I find this resource
/**
* @function st.idToUri
*
* `steal.idToUri( id, noJoin )` takes an id and returns a URI that
* is the location of the file. It uses the paths option of [config].
* Passing true for `noJoin` does not join from the root URI.
Expand All @@ -107,6 +109,8 @@ st.idToUri = function( id, noJoin ) {

// for a given AMD id this will return an URI object
/**
* @function st.amdIdToUri
*
* `steal.amdIdToUri( id, noJoin )` takes and AMD id and returns a URI that
* is the location of the file. It uses the paths options of [config].
* Passing true for `noJoin` does not join from that URI.
Expand Down Expand Up @@ -152,6 +156,20 @@ if(config.attr('amd') === true){
// convert resources to modules ...
// a function is a module definition piece
// you steal(moduleId1, moduleId2, function(module1, module2){});
/**
* @function window.define
*
* AMD compatible `define` function. It is available only if steal's
* `amd` param is set to true:
*
* <script type="text/javascript">
* steal = {
* amd : true
* }
* <script />
* <script type="text/javascript" src="steal/steal.js"></script>
*
*/
h.win.define = function( moduleId, dependencies, method ) {
if(typeof moduleId == 'function'){
modules[URI.cur+""] = moduleId();
Expand All @@ -177,6 +195,20 @@ if(config.attr('amd') === true){
}

}
/**
* @function window.require
*
* AMD compatible require function. It is available only if steal's
* `amd` param is set to true:
*
* <script type="text/javascript">
* steal = {
* amd : true
* }
* <script />
* <script type="text/javascript" src="steal/steal.js"></script>
*
*/
h.win.require = function(dependencies, method){
var depends = h.map(dependencies, function(dependency){
dependency = typeof dependency === "string" ? {
Expand Down
4 changes: 3 additions & 1 deletion core/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/*
/**
* @function st.getScriptOptions
*
* `steal.getScriptOptions` is used to determine various
* options passed to the steal.js file:
*
Expand Down
6 changes: 6 additions & 0 deletions core/config_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@
*
**/



var ConfigManager = function(options){
this.stealConfig = {};
this.callbacks = [];
this.attr(ConfigManager.defaults);
this.attr(options)
}

h.extend(ConfigManager.prototype, {
// get or set config.stealConfig attributes
attr: function( config ) {
Expand Down Expand Up @@ -111,10 +114,12 @@ h.extend(ConfigManager.prototype, {

return this;
},

// add callbacks which are called after config is changed
on: function(cb){
this.callbacks.push(cb)
},

// get the current start file
startFile: function(startFile){
// make sure startFile and production look right
Expand All @@ -125,6 +130,7 @@ h.extend(ConfigManager.prototype, {
},

/**
*
* Read or define the path relative URI's should be referenced from.
*
* window.location //-> "http://foo.com/site/index.html"
Expand Down
3 changes: 0 additions & 3 deletions core/deferred.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// steal's deferred library. It is used through steal
// to support jQuery like API for file loading.
//
// This is a low level library and it's never exposed to
// the end user

var Deferred = function( func ) {
if (!(this instanceof Deferred)) return new Deferred();
Expand Down
Loading

0 comments on commit fd7f757

Please sign in to comment.