如何使用公共静态实现模块模式

How to implement the module pattern with public statics?

本文关键字:实现 模块 模式 静态 何使用      更新时间:2023-09-26

我的公共静态是用户操作的接口 - 即GUI。 下面是当用户在"登录和注册"窗体上按 Enter 键时绑定的两个。

我不确定我是否理解这个问题,但为什么不以这种方式呢?

/**
 *Control
 */
var Control = ( function () 
{
    var Control = function ( ) // constructor 
    {
    };
    Control.prototype.function_1 = function( ) // public - instance 
    {
    };
    Control.in = function()
    {
        new Control( 'signin' ).invoke();
    };
    Control.up = function()
    {
        new Control( 'signup' ).invoke();
    };
    Control.out = function()
    {
        AjaxNew.repeatUse( '&ajax_type=ControlSignOut', function( server_response_text ) { ajaxType( server_response_text, 0, 'simple' ); } );
    };
    Control.try = function()
    {
        AjaxNew.repeatUse( '&ajax_type=ControlTryIt', function( server_response_text ) { ajaxType( server_response_text, 0, 'simple' ); } );
    };
    return Control;
} () );