title: How to call a javascript function from .js file on page load?
body: <p>I really can't figure out how to do it. I need to call <code>somefunc()</code> from <code>file.js</code> file on page load.</p>
  
  <p>My <code>file.js</code> contains:</p>
  
  <pre><code>function somefunc() {
      pc.somefunc(gotLocalDescription,
  
      function(error) {
          console.log(error)
      }, {
          'mandatory': {
              'OfferToReceiveAudio': true,
              'OfferToReceiveVideo': true
          }
      });
  }
  
  // Socket.io    
  var socket = io.connect('', {
      port: 1234
  });
  
  function sendCall(call) {
      socket.emit('call', call);
  }
  
  socket.on('call', function(call) {
      if (call.type === 'offer') {
          pc.setRemoteDescription(new SessionDescription(call));
          createAnswer();
      } else if (call.type === 'answer') {
          console.log('10--if call type is answer');
          pc.setRemoteDescription(new SessionDescription(call));
      } else if (call.type === 'candidate') {
          var candidate = new IceCandidate({
              sdpMLineIndex: call.label,
              candidate: call.candidate
          });
          pc.addIceCandidate(candidate);
      }
  });
  </code></pre>