Sha256: 484adf097f884286d344bfbced9e77cd519f7a7deb2e7439046cd58b15a29d0d
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
/* File: application.js Class: NinjsApplication An NinjsApplication object serves as your application's namespace and includes a utility to add modules to the application object. See Also: <NinjsModule> */ var NinjsApplication = function(base_url, tests_path) { if(is_defined(tests_path)) { this.tests_path = tests_path; } if(is_defined(base_url)) { this.site_url = function(path) { var path = path || ''; return base_url + path; }; } }; /* Method: add_module Adds a NinjsModule to the application. Parameters: name - the name of the module > myapp.add_module('my_module'); */ NinjsApplication.method('add_module', function(name) { if (is_undefined(name)) { throw new SyntaxError("NinjsApplication.add_module(name): name is undefined"); } if (is_defined(this[name])) { throw new SyntaxError("NinjsApplication.add_module(name): '" + name + "' already declared"); } if (this.name === name) { throw new SyntaxError("NinjsApplication.add_module(name): a module cannot have the same name as the application"); } return this[name] = new NinjsModule(name); });
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ninjs-0.13.8 | repository/ninjs/core/application.js |
ninjs-0.13.6 | repository/ninjs/core/application.js |
ninjs-0.13.5 | repository/ninjs/core/application.js |