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:
delphinus
2016-03-06 11:27:38 +09:00
parent 38c8b14be8
commit 4248215ed4
2 changed files with 16 additions and 0 deletions

View File

@@ -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");
}

View File

@@ -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;
}