How to keep a connection?


how to keep this connection , when clicked the li element, i want to use this connection everywhere
how to define a global variable?

@li.on 'click','li', ->
    SSH = new SSH_Connection()
    console.log SSH


Perhaps you should elaborate and tell us what exactly you’re trying to achieve with this?


I’m writing a package, like xshell or SecureCRT, switch the servers

  <li host='' password='111'  username='hello'></li>
  <li host='' password='111'  username='hello'></li>

when clicked the li ele:

@li.on 'click','li', ->
    host =
    password = this.password
    username = this.username
    SSH = new SSH_Connection(host,username,password)
    # here:  SSH connection can not use in the atom window , i want to define a global variable when the window loaded, use this connection at anytime anywhere , until i close the window or click another server  
    # when clicked the server ip, i want to use it in pane or menu , treeview to connect 
    #does not need to establish a new connection
    #I tried several ways,does not work