mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add optional args support in runloop.run (#37062)
* add optional args support in runloop.run * add additional tests for runloop.run * remove trailing whitespace * remove trailing whitespace
This commit is contained in:
parent
70ba0dd2b4
commit
bf4b5e76bd
@ -20,6 +20,26 @@ function testRun() {
|
||||
return 123;
|
||||
});
|
||||
|
||||
// run(target, method)
|
||||
run({}, () => {
|
||||
// code to be executed within a RunLoop
|
||||
return 123;
|
||||
});
|
||||
|
||||
// run(target, method, ...args)
|
||||
run(
|
||||
{},
|
||||
() => {
|
||||
// code to be executed within a RunLoop
|
||||
return 123;
|
||||
},
|
||||
() => {
|
||||
console.log('foo');
|
||||
},
|
||||
'bar',
|
||||
{}
|
||||
);
|
||||
|
||||
function destroyApp(application: EmberObject) {
|
||||
run(application, 'destroy');
|
||||
run(application, function() {
|
||||
|
||||
2
types/ember__runloop/index.d.ts
vendored
2
types/ember__runloop/index.d.ts
vendored
@ -16,7 +16,7 @@ export interface RunNamespace {
|
||||
* end.
|
||||
*/
|
||||
<Ret>(method: (...args: any[]) => Ret): Ret;
|
||||
<Target, Ret>(target: Target, method: RunMethod<Target, Ret>): Ret;
|
||||
<Target, Ret>(target: Target, method: RunMethod<Target, Ret>, ...args: any[]): Ret;
|
||||
/**
|
||||
* If no run-loop is present, it creates a new one. If a run loop is
|
||||
* present it will queue itself to run on the existing run-loops action
|
||||
|
||||
Loading…
Reference in New Issue
Block a user