mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 14:59:37 +08:00
Add factory for module
package `jquery-easy-loading` will return a factory for the library itself if you use this not in the browser env.
This commit is contained in:
@@ -37,3 +37,12 @@ function test_commands() {
|
||||
.loading("stop")
|
||||
.loading("toggle");
|
||||
}
|
||||
|
||||
import * as jQuery from "jquery";
|
||||
import * as factory from "jquery-easy-loading";
|
||||
|
||||
function test_factory() {
|
||||
|
||||
const $loading: JQueryStatic = factory(window, jQuery);
|
||||
$loading("body").loading("start");
|
||||
}
|
||||
|
||||
7
jquery-easy-loading/jquery-easy-loading.d.ts
vendored
7
jquery-easy-loading/jquery-easy-loading.d.ts
vendored
@@ -190,3 +190,10 @@ interface JQuery {
|
||||
*/
|
||||
Loading(options?: JQueryEasyLoading.Options): JQueryEasyLoading.LoadingObject;
|
||||
}
|
||||
|
||||
declare var factory: (root?: any, jQuery?: JQueryStatic) => JQueryStatic;
|
||||
|
||||
declare module "jquery-easy-loading" {
|
||||
|
||||
export = factory;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user