0

I have the following javascript in a file:

var MyNamespace = function () {
    return {
         blockUI: function (options) {
             alert(1);          
         }
    };
}();

fiddle: http://jsfiddle.net/dm0bzzxt/

I want to call:

MyNamespace.blockUI();

from a typescript file.

I understood how to do it for ordinary javascript functions:

declare function blockUI();

But can't understand how to do it for the above.

7
  • that isn't valid javascript. Commented Oct 21, 2014 at 16:38
  • The OP said he's using typescript. Commented Oct 21, 2014 at 16:38
  • @Andy the first block im referring to. Commented Oct 21, 2014 at 16:39
  • Oh, yeah. Well spotted. Commented Oct 21, 2014 at 16:39
  • Hmm. Seems i have misunderstood things here. Give me a sec. Commented Oct 21, 2014 at 16:43

1 Answer 1

1
declare module MyNamespace {
    function blockUI(): void;
}
Sign up to request clarification or add additional context in comments.

1 Comment

Aha, module. Thanks Ryan!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.