外側の var Message と内側の var Message の間の接続は何ですか?
呼び出し
new Message ( element ).display( server_response_text.slice( 6 ) );
物体
var Message = ( function ()
{
var messages =
{
name: 'Please enter a valid name',
email: 'Please enter a valid email',
email_s: 'Please enter a valid email.',
pass: 'Please enter passoword, 6-40 characters',
url: 'Please enter a valid url',
title: 'Please enter a valid title',
tweet: 'Please enter a valid tweet',
empty: 'Please complete all fields',
same: 'Please make emails equal',
taken: 'Sorry, that email is taken',
validate: 'Please contact <a class="d" href="mailto:here@host.com">support</a> to reset your password',
};
var Message = function (element)
{
this.element = element;
};
Message.prototype.display = function( type )
{
this.element.innerHTML = messages[ type ];
new Effects().fade( this.element, 'down', 4000 );
};
return Message;
} () );
私のライブラリ全体は、このようなモジュールパターンを使用しています
var NS = ( function ( window, undefined )
{
/*
all code here including Message
*/
} )( window );