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

  • SEARCH
  • Home
  • 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 6119207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:31:31+00:00 2026-05-23T15:31:31+00:00

//namespace if (!window.SlidePanel) { window.SlidePanel = (function () { var SlidePanel = {}; return

  • 0
//namespace
if (!window.SlidePanel) {
    window.SlidePanel = (function () {
        var SlidePanel = {};

        return SlidePanel;
    })();
}   

SlidePanel.panel = function (el) {
    this.$ = el;
}
SlidePanel.panel.prototype = {
    insert: function () {
    },
    show: function () {
    },
    hide: function () {
    }        
}

SlidePanel.up = new SlidePanel.panel($('div#up-panel'));
SlidePanel.bottom = new SlidePanel.panel($('div#bottom-panel'));
SlidePanel.left = new SlidePanel.panel($('div#left-panel'));
SlidePanel.right = new SlidePanel.panel($('div#right-panel'));

I want to be able to set show and hide functions in some place of code. I thought to add setShowFn and setHideFn function to SlidePanel.panel.prototype like this

  SlidePanel.panel.prototype = {
        ...
        setShowFn: function (fn) {
            this.show = fn;
        },
        setHideFn: function (fn) {
            this.hide = fn;
        }
  }

Is this a good approach or there is more elegant way to do this?

  • 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-23T15:31:32+00:00Added an answer on May 23, 2026 at 3:31 pm

    If you want to override the show or hide function on just one instance of a SlidePanel.panel, you’re free to just update that instance:

    SlidePanel.up.show = function() { /* ... */ };
    

    That breaks the inheritance of show for that specific instance, without changing any other instances that still use the show property from the prototype.

    If you want to update show for all instances that are using the inherited version, you can do this at any time:

    SlidePanel.panel.prototype.show = function() { /* ... */ };
    

    …since the instances have a reference back to the prototype, and so changes to the prototype happen “live.” Note that any instance on which you’ve done the first example above will be unaffected, because it’s not using the version of show from the prototype anymore.

    And yes, you’re free to encapsulate this in your setShowFn and setHideFn functions if you want to; just be aware that there’s nothing other than convention/documentation preventing code from assigning to the properties directly even if you do.

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

Sidebar

Related Questions

here is my javascript: function namespace(nameSpaceString){ var parts = nameSpaceString.split(.); var parent = window;
I found following in javascript code function calculateURI(uri) { return (namespace.push.configuration.uriPrefix || '') +
To keep the global namespace clean, my JavaScript code is wrapped like this: (function()
I have a Javascript function with a namespace and I am using Prototype to
Am I doing something wrong or is this just not possible: (function(namespace,undefined) { //Private
In winform, I do this : using (vbdadvertisementEntities context = new vbdadvertisementEntities()) { var
<Window x:Class=MyWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:src=clr-namespace:WpfApplication1 Title=ContactsSelector Height=300 Width=300> <Window.Content> <src:MyPage> <!--MyPage is a page
MainWindow.xaml <Window x:Class=MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:my=clr-namespace:MyStuff;assembly=MyStuff Title=MainWindow Height=350 Width=525> <Grid> <TabControl Margin=5> <TabItem Header=Start
Check this xaml: <Window x:Class=MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:sys=clr-namespace:System;assembly=mscorlib Width=300> <ListBox HorizontalContentAlignment=Stretch Grid.IsSharedSizeScope=True> <ListBox.ItemsSource> <x:Array
I am developing window phone 7 application. I am new to the Window Phone

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.