From 4248215ed47764e01302172df1a58c3d6414ff12 Mon Sep 17 00:00:00 2001 From: delphinus Date: Sun, 6 Mar 2016 11:27:38 +0900 Subject: [PATCH] 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. --- jquery-easy-loading/jquery-easy-loading-tests.ts | 9 +++++++++ jquery-easy-loading/jquery-easy-loading.d.ts | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/jquery-easy-loading/jquery-easy-loading-tests.ts b/jquery-easy-loading/jquery-easy-loading-tests.ts index 704b75efea..d96d8c2edf 100644 --- a/jquery-easy-loading/jquery-easy-loading-tests.ts +++ b/jquery-easy-loading/jquery-easy-loading-tests.ts @@ -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"); +} diff --git a/jquery-easy-loading/jquery-easy-loading.d.ts b/jquery-easy-loading/jquery-easy-loading.d.ts index 5b93e325b4..c20792eb86 100644 --- a/jquery-easy-loading/jquery-easy-loading.d.ts +++ b/jquery-easy-loading/jquery-easy-loading.d.ts @@ -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; +}