Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    utilizzo Revealing Module Pattern

    codice:
    var panel = function () {
       var init = function(nome){
         alert(nome)
       }
       return {
         init: init
       }
    }();
    
    // metodo 1
    var a = new panel;
    a.init('pippo');
    a.init('mario');
    
    // metodo 2
    panel.init('pippo'); 
    panel.init('mario');
    in pratica devo usare la classe su due form html differenti

    ovviamente lo script più complesso......qual' è il metodo corretto da usare e eventualmente brevemente il perchè?

    grazie

  2. #2
    Codice PHP:
    var panel = function () {
       var 
    init = function(nome){
         
    alert(nome)
       }
       return {
         
    initinit
       
    }
    }();
    var 
    panel1 = function () {
       var 
    init = function(nome){
         
    alert(nome)
       }
       return {
         
    initinit
       
    }
    };
    alert(panel.constructor);
    alert(panel1.constructor); 
    Il Revealing Module Pattern non c'entra proprio
    una bella p.pp.
    Ad ogni modo grazie mi hai fatto scoprire un
    bel link


    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  3. #3
    ma quindi creare un 'istanza della class con new non serve a niente?

  4. #4
    Originariamente inviato da alexforum
    ma quindi creare un 'istanza della class con new non serve a niente?
    si è già un oggetto.

    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.