Skip to content

Commit

Permalink
Added missing declarations for QJSEngine::ConsoleExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
JoergAtGithub committed Jun 6, 2022
1 parent b9310a5 commit b1d689c
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1 deletion.
73 changes: 73 additions & 0 deletions res/controllers/console-api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

/** Mixxx installs the QJSEngine::ConsoleExtension for the use in controller mapping scripts.
See also: https://doc.qt.io/qt-5/qtquick-debugging.html#console-api
*/

declare class QJSEngineConsoleExtension {
/**
* Prints debugging information to the console.
*/
public log(message? : any, ...args : any[]) : void;
public debug(message? : any, ...args : any[]) : void;
public info(message? : any, ...args : any[]) : void;
public warn(message? : any, ...args : any[]) : void;
public error(message? : any, ...args : any[]) : void;

/**
* Tests that an expression is true.
* If not, it writes an optional message to the console and prints the stack trace.
*/
public assert(value: any, message? : string, ...args: any[]) : void;

/**
* Starts the time measurement, which will be printed by timeEnd
*
* @param {string} [label] string argument that identifies the measurement.
*/
public time(label? : string) : void;
/**
* Logs the time (in milliseconds) that was spent since the call of the time method.
*
* @param {string} [label] string argument that identifies the measurement.
*/
public timeEnd(label? : string) : void;

/**
* Prints the stack trace of the JavaScript execution at the point where it was called.
* This stack trace information contains the function name, file name, line number, and column number.
* The stack trace is limited to last 10 stack frames.
*
* @param {*} [message]
* @param {...any[]} args
*/
public trace(message? : any, ...args : any[]) : void;

/**
* Prints the current number of times a particular piece of code has run, along with a message.
*
* @param {string} [label]
*/
public count(label? : string) : void;

/**
* Turns on the JavaScript profiler.
* @deprecated Not usable for mappings, because JavaScript profile does only workin GUI thread: https://bugreports.qt.io/browse/QTBUG-65419
*
*/
public profile(label? : string) : void;

/**
* Turns off the JavaScript profiler.
* @deprecated Not usable for mappings, because JavaScript profile does only workin GUI thread: https://bugreports.qt.io/browse/QTBUG-65419
*
*/
public profileEnd(label? : string) : void;

/**
* Prints an error message together with the stack trace of JavaScript execution at the point where it is called.
*
*/
public exception(message? : any, ...args : any[]) : void;

}
var console = new QJSEngineConsoleExtension;
1 change: 0 additions & 1 deletion res/controllers/engine-api.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

declare var print = function(message : string) {};

declare class ControllerScriptInterfaceLegacy {
public getValue(group : string, name : string) : number;
Expand Down

0 comments on commit b1d689c

Please sign in to comment.