-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hook up component scripts to the view
- Loading branch information
Showing
8 changed files
with
152 additions
and
81 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
var racer = require('racer') | ||
var path = require('path') | ||
, racer = require('racer') | ||
, View = require('./View') | ||
, derby = module.exports = Object.create(racer) | ||
, derbyPlugin = racer.util.isServer ? | ||
__dirname + '/derby.server' : require('./derby.browser'); | ||
|
||
// Allow derby object to be targeted via plugin.decorate | ||
racer._makePlugable('derby', derby); | ||
|
||
// Shared methods for both server and browser | ||
derby._libraries = {}; | ||
derby.createLibrary = createLibrary; | ||
|
||
// Add appropriate server-side or browser-side methods | ||
derby.use(derbyPlugin); | ||
|
||
function createLibrary(filename, scripts, options) { | ||
if (!options) options = {}; | ||
var root = path.dirname(filename) | ||
, name = options.name || path.basename(root) | ||
, view = new View; | ||
|
||
this._libraries[name] = { | ||
root: root | ||
, view: view | ||
, scripts: scripts | ||
}; | ||
} |
Oops, something went wrong.