Upgraded jbaldwin projs to 0.9.1.0

This commit is contained in:
jbaldwin
2013-08-19 16:19:56 -06:00
parent 23f2e1cd15
commit f6c5a200e5
8 changed files with 4030 additions and 1704 deletions
+152 -83
View File
@@ -1,21 +1,67 @@
// require-2.1.1.d.ts
// (c) 2012 Josh Baldwin
// require.d.ts may be freely distributed under the MIT license.
// For all details and documentation:
// https://github.com/jbaldwin/require.d.ts
/*
require-2.1.5.d.ts may be freely distributed under the MIT license.
Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/require.d.ts
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
interface RequireError extends Error {
/**
* Error Type
**/
requireType: string;
/**
* Required modules.
**/
requireModules: string[];
/**
* Original error, might be null.
**/
originalError: Error;
}
interface RequireShim {
// List of dependencies.
/**
* List of dependencies.
**/
deps?: string[];
// Name the module will be exported as.
/**
* Name the module will be exported as.
**/
exports?: string;
// Initialize function with all dependcies passed in,
// if the function returns a value then that value is used
// as the module export value instead of the object
// found via the 'exports' string.
/**
* Initialize function with all dependcies passed in,
* if the function returns a value then that value is used
* as the module export value instead of the object
* found via the 'exports' string.
* @param dependencies
* @return
**/
init?: (...dependencies: any[]) => any;
}
@@ -30,7 +76,7 @@ interface RequireConfig {
// Dictionary of Shim's.
// does not cover case of key->string[]
shim?: { [key: string]: RequireShim; };
shim?: { [key: string]: RequireShim; };
/**
* For the given module prefix, instead of loading the
@@ -49,43 +95,60 @@ interface RequireConfig {
* }
* });
**/
map?: {
map?: {
[id: string]: {
[id: string]: string;
};
};
// AMD configurations, use module.config() to access in
// define() functions
config?: { [id: string]: { }; };
/**
* AMD configurations, use module.config() to access in
* define() functions
**/
config?: { [id: string]: {}; };
// Configures loading modules from CommonJS packages.
packages?: { };
/**
* Configures loading modules from CommonJS packages.
**/
packages?: {};
// The number of seconds to wait before giving up on loading
// a script. The default is 7 seconds.
/**
* The number of seconds to wait before giving up on loading
* a script. The default is 7 seconds.
**/
waitSeconds?: number;
// A name to give to a loading context. This allows require.js
// to load multiple versions of modules in a page, as long as
// each top-level require call specifies a unique context string.
/**
* A name to give to a loading context. This allows require.js
* to load multiple versions of modules in a page, as long as
* each top-level require call specifies a unique context string.
**/
context?: string;
// An array of dependencies to load.
/**
* An array of dependencies to load.
**/
deps?: string[];
// A function to pass to require that should be require after
// deps have been loaded.
/**
* A function to pass to require that should be require after
* deps have been loaded.
* @param modules
**/
callback?: (...modules: any[]) => void;
// If set to true, an error will be thrown if a script loads
// that does not call define() or have shim exports string
// value that can be checked.
enforceDefine?: boolean;
/**
* If set to true, an error will be thrown if a script loads
* that does not call define() or have shim exports string
* value that can be checked.
**/
enforceDefine?: bool;
// If set to true, document.createElementNS() will be used
// to create script elements.
xhtml?: boolean;
/**
* If set to true, document.createElementNS() will be used
* to create script elements.
**/
xhtml?: bool;
/**
* Extra query string arguments appended to URLs that RequireJS
@@ -107,11 +170,13 @@ interface RequireConfig {
}
// not sure what to do with this guy
// todo: not sure what to do with this guy
interface RequireModule {
config(): { };
/**
*
**/
config(): {};
}
@@ -124,92 +189,96 @@ interface RequireMap {
fullName: string;
}
interface Require {
interface Require {
// Configure require.js
config(config: RequireConfig): Require;
/**
* Configure require.js
**/
config(config: RequireConfig): void;
// Start the main app logic.
// Callback is optional.
// Can alternatively use deps and callback.
(module: string): any;
(modules: string[], ready?: (...modules: any[]) => void, errorCallback?: (err : RequireError) => void): void;
/**
* Start the main app logic.
* Callback is optional.
* Can alternatively use deps and callback.
* @param modules Required modules to load.
**/
(modules: string[]): void;
// Generate URLs from require module
/**
* @see Require()
* @param ready Called when required modules are ready.
**/
(modules: string[], ready: (...modules: any[]) => void ): void;
/**
* Generate URLs from require module
* @param module Module to URL
* @return URL string
**/
toUrl(module: string): string;
// On Error override
onError(): void;
/**
* On Error override
* @param err
**/
onError(err: RequireError): void;
// Undefine a module
/**
* Undefine a module
* @param module Module to undefine.
**/
undef(module: string): void;
// Semi-private function, overload in special instance of undef()
/**
* Semi-private function, overload in special instance of undef()
**/
onResourceLoad(context: Object, map: RequireMap, depArray: RequireMap[]): void;
}
interface RequireError
{
requireType: string;
requireModules: string[];
originalError?: string;
contextName? : string;
requireMap?: any;
}
interface RequireDefine {
/**
* Define Simple Name/Value Pairs
* @config Dictionary of Named/Value pairs for the config.
* @param config Dictionary of Named/Value pairs for the config.
**/
(config: { [key: string]: any; }): void;
/**
* Define function.
* @func: The function module.
* @param func: The function module.
**/
(func: () => any): void;
/**
* Define function with dependencies.
* @deps List of dependencies module IDs.
* @ready Callback function when the dependencies are loaded.
* @deps module dependencies
* @return module definition
* @param deps List of dependencies module IDs.
* @param ready Callback function when the dependencies are loaded.
* callback param deps module dependencies
* callback return module definition
**/
(deps: string[], ready: (...deps: any[]) => any): void;
/**
* Define module with simplified CommonJS wrapper.
* @ready
* @require requirejs instance
* @exports exports object
* @module module
* @return module definition
* @param ready
* callback require requirejs instance
* callback exports exports object
* callback module module
* callback return module definition
**/
(ready: (require: Require, exports: { [key: string]: any; }, module: RequireModule) => any): void;
/**
* Define a module with a name and dependencies.
* @name The name of the module.
* @deps List of dependencies module IDs.
* @ready Callback function when the dependencies are loaded.
* @deps module dependencies
* @return module definition
* @param name The name of the module.
* @param deps List of dependencies module IDs.
* @param ready Callback function when the dependencies are loaded.
* callback deps module dependencies
* callback return module definition
**/
(name: string, deps: string[], ready: (...deps: any[]) => any): void;
/**
* Defines whether require js supports multiple versions of jQuery being loaded
**/
amd: {
jQuery: boolean;
};
}
// Ambient declarations for 'require' and 'define'
declare var require: Require;
declare var requirejs: Require;
declare var req: Require;
declare var define: RequireDefine;