diff --git a/types/mathjax/index.d.ts b/types/mathjax/index.d.ts index 74783d765c..129cd132b3 100644 --- a/types/mathjax/index.d.ts +++ b/types/mathjax/index.d.ts @@ -4,27 +4,27 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // These are slightly preliminary and can use some more strong typing here and there. Please feel free to improve. -declare var MathJax: jax.IMathJax; +declare var MathJax: MathJax; -declare namespace jax { +interface MathJax { + Hub?: MathJax.Hub; + Ajax?: MathJax.Ajax; + Message?: MathJax.Message; + HTML?: MathJax.HTML; + Callback?: MathJax.Callback; + Localization?: MathJax.Localization; + InputJax?: MathJax.InputJax; + OutputJax?: MathJax.OutputJax; +} - export interface IMathJax { - Hub?: IMathJaxHub; - Ajax?: IAjax; - Message?: IMessage; - HTML?: IHTML; - Callback?: ICallback; - Localization?: ILocalization; - InputJax?: IInputJax; - OutputJax?: IOutputJax; - } +declare namespace MathJax { - export interface ICallback { - (fn: Function): ICallbackObject; - (fns: Function[]): ICallbackObject; - (objs: any[]): ICallbackObject; - (obj: any): ICallbackObject; - (code: string): ICallbackObject; + export interface Callback { + (fn: Function): CallbackObject; + (fns: Function[]): CallbackObject; + (objs: any[]): CallbackObject; + (obj: any): CallbackObject; + (code: string): CallbackObject; /*Waits for the specified time (given in milliseconds) and then performs the callback. It returns the Callback * object (or a blank one if none was supplied). The returned callback structure has a timeout property set to * the result of the setTimeout() call that was used to perform the wait so that you can cancel the wait, if @@ -33,36 +33,36 @@ declare namespace jax { * Since MathJax.Callback.Delay() returns a callback structure, it can be used in a callback queue to insert a * delay between queued commands. */ - Delay(time: number, callback: any): ICallbackObject; + Delay(time: number, callback: any): CallbackObject; /*Creates a MathJax.CallBack.Queue object and pushes the given callbacks into the queue. See Using Queues for * more details about MathJax queues. */ - Queue(...args: any[]): IQueue; + Queue(...args: any[]): Queue; /*Looks for a named signal, creates it if it doesn’t already exist, and returns the signal object. See Using * Signals for more details. */ - Signal(name: string): ISignal; + Signal(name: string): Signal; /*Calls each callback in the hooks array (or the single hook if it is not an array), passing it the arguments * stored in the data array. If reset is true, then the callback’s reset() method will be called before each hook * is executed. If any of the hooks returns a Callback object, then it collects those callbacks and returns a new * callback that will execute when all the ones returned by the hooks have been completed. Otherwise, * MathJax.Callback.ExecuteHooks() returns null. */ - ExecuteHooks(hooks: any[], data: any[], reset: boolean): ICallbackObject; + ExecuteHooks(hooks: any[], data: any[], reset: boolean): CallbackObject; /*Creates a prioritized list of hooks that are called in order based on their priority (low priority numbers are * handled first). This is meant to replace MathJax.Callback.ExecuteHooks() and is used internally for signal * callbacks, pre- and post-filters, and other lists of callbacks. */ - Hooks(reset: boolean): IHooks; + Hooks(reset: boolean): Hooks; } - export interface IHooks { - Add(hook: any, priority: number): ICallbackObject; - Remove(hook: ICallbackObject): void; - Execute(): ICallbackObject; + export interface Hooks { + Add(hook: any, priority: number): CallbackObject; + Remove(hook: CallbackObject): void; + Execute(): CallbackObject; } - export interface IQueue { + export interface Queue { /*This is non-zero when the queue is waiting for a command to complete, i.e. a command being processed returns a * Callback object, indicating that the queue should wait for that action to complete before processing * additional commands. @@ -78,7 +78,7 @@ declare namespace jax { * to be executed, but a wait for that callback is queued. The Push() method returns the last callback that was * added to the queue (so that it can be used for further synchronization, say as an entry in some other queue). */ - Push(specs: any[]): ICallbackObject; + Push(specs: any[]): CallbackObject; /*Process the commands in the queue, provided the queue is not waiting for another command to complete. This * method is used internally; you should not need to call it yourself. */ @@ -106,7 +106,7 @@ declare namespace jax { call(): void; } - export interface ISignal { + export interface Signal { /*The name of the signal. Each signal is named so that various components can access it. The first one to * request a particular signal causes it to be created, and other requests for the signal return references * to the same object. @@ -120,7 +120,7 @@ declare namespace jax { /*Array of callbacks to the listeners who have expressed interest in hearing about posts to this signal. * When a post occurs, the listeners are called, each in turn, passing them the message that was posted. */ - listeners: ICallbackObject[]; + listeners: CallbackObject[]; /*Posts a message to all the listeners for the signal. The listener callbacks are called in turn (with the * message as an argument), and if any return a Callback object, the posting will be suspended until the callback * is executed. In this way, the Post() call can operate asynchronously, and so the callback parameter is used to @@ -135,8 +135,8 @@ declare namespace jax { * * Returns the callback object (or a blank callback object if none was provided). */ - Post(message: string): ICallbackObject; - Post(message: string, callback: ICallbackObject): ICallbackObject; + Post(message: string): CallbackObject; + Post(message: string, callback: CallbackObject): CallbackObject; /*This causes the history of past messages to be cleared so new listeners will not receive them. Note that since * the signal may be operating asynchronously, the Clear() may be queued for later. In this way, the Post() and * Clear() operations will be performed in the proper order even when they are delayed. The callback is called @@ -144,8 +144,8 @@ declare namespace jax { * * Returns the callback (or a blank callback if none is provided). */ - Clear(): ICallbackObject; - Clear(callback: ICallbackObject): ICallbackObject; + Clear(): CallbackObject; + Clear(callback: CallbackObject): CallbackObject; /*This method registers a new listener on the signal. It creates a Callback object from the callback * specification, attaches it to the signal, and returns that Callback object. When new messages are posted to * the signal, it runs the callback, passing it the message that was posted. If the callback itself returns a @@ -155,13 +155,13 @@ declare namespace jax { * If ignorePast is false or not present, then before Interest() returns, the callback will be called with all * the past messages that have been sent to the signal. */ - Interest(callback: ICallbackObject): ICallbackObject; - Interest(callback: ICallbackObject, ignorePast: boolean): ICallbackObject; + Interest(callback: CallbackObject): CallbackObject; + Interest(callback: CallbackObject, ignorePast: boolean): CallbackObject; /*This removes a listener from the signal so that no new messages will be sent to it. The callback should be the * one returned by the original Interest() call that attached the listener to the signal in the first place. * Once removed, the listener will no longer receive messages from the signal. */ - NoInterest(callback: ICallbackObject): void; + NoInterest(callback: CallbackObject): void; /*This creates a callback that is called whenever the signal posts the given message. This is a little easier * than having to write a function that must check the message each time it is called. Although the message here * is a string, if a message posted to the signal is an array, then only the first element of that array is used @@ -170,12 +170,12 @@ declare namespace jax { * * Returns the Callback object that was produced. */ - MessageHook(message: string, callback: ICallbackObject): ICallbackObject; + MessageHook(message: string, callback: CallbackObject): CallbackObject; /*Used internally to call the listeners when a particular message is posted to the signal.*/ ExecuteHook(message: string): void; } - export interface ICallbackObject { + export interface CallbackObject { /*The function to be called when the callback is executed.*/ hook: number; /*An array containing the arguments to pass to the callback function when it is executed.*/ @@ -193,11 +193,11 @@ declare namespace jax { reset(): void; } - export interface IMathJaxHub { + export interface Hub { /*This holds the configuration parameters for MathJax. Set these values using MathJax.Hub.Config() described * below. The options and their default values are given in the Core Options reference page. */ - config?: IMathJaxConfig; + config?: Config; /*The minimum time (in milliseconds) between updates of the “Processing Math” message. After this amount of time * has passed, and after the next equation has finished being processed, MathJax will stop processing momentarily * so that the update message can be displayed, and so that the browser can handle user interaction. @@ -208,14 +208,14 @@ declare namespace jax { */ processUpdateDelay?: number; /*The hub processing signal (tied to the MathJax.Hub.Register.MessageHook() method).*/ - signal?: ISignal; + signal?: Signal; /*MathJax’s main processing queue. Use MathJax.Hub.Queue() to push callbacks onto this queue.*/ queue?: any; /*The name of the browser as determined by MathJax. It will be one of Firefox, Safari, Chrome, Opera, MSIE, * Konqueror, or unkown. This is actually an object with additional properties and methods concerning the * browser */ - Browser?: IBrowserInfo; + Browser?: BrowserInfo; /*An object storing the MIME types associated with the various registered input jax (these are the types of the *