Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6026927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:30:58+00:00 2026-05-23T04:30:58+00:00

Im creating a new library for a company. The structure I follow is (function()

  • 0

Im creating a new library for a company. The structure I follow is

    (function() {
            var lib = function() {
                    //some private and public fn definitions

                    //setting publically avbl functions
                    return {
                    func1 : func1, func2: func2
                    };
            };
            return (window.lib = lib);
    })();

Now how I call this is

    lib.func1();

I want to be able to call my library as

    lib(function | string | object).someproperty

How do I convert my code. Tried something like this

    function lib() {
            return new arguments.callee(arguments);
    }

    lib.prototype={
            publicfunc: function() {
            }
    }

In this i’m having some problems accessing private functions since it is out of the scope for the public functions defined in the lib’s prototype.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:30:59+00:00Added an answer on May 23, 2026 at 4:30 am
    var lib = (function (param) {
    
       var func = function () {
         /// your code
    
         return {
             animate : function () {
              // do the animation
              return this;
         }
       }
    
       return func;
    })();
    

    this can be the basic fprmat.

    ok here is how i can be used.

    lib(function() {...});
    

    or

    lib(selectItem).animate();
    

    because i returned this i can run another method if there is any.

    lib(selectItem).animate().animate().animate().animate() ....;
    

    i hope you can find a use of this format, of course i made it very basic

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating new Site Definitions using this method: http://weblogs.asp.net/paulballard/archive/2007/04/09/creating-a-custom-sharepoint-2007-portal-site-definition-using-the-portalprovisioningprovider-class.aspx and when they get created,
I have some conditional formatting styles. I don't want to keep creating new rules
I'm creating a new app and I want to use some libraries like this:
I am creating a new Widget using the same structure/style as the other Swing
I'm not looking for a Neural Networks library, since I'm creating new kinds of
I'm currently creating a new neat CLI library for PHP, and i'd like to
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
When I'm creating new project with GWT plug in it creates a skeleton project
Can I avoid third party code from creating new threads, starting new VMs, or
I need UNION two tables with creating new field, where 1 for first table,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.