javascript - Does a self-executing function execute the function when it is loaded into this js?
習慣沉默
習慣沉默 2017-05-16 13:19:41
0
2
556
(function() { 'use strict'; angular.module('app').controller('demoCtrl', demo); demo.$inject = [ '$location', 'demoSvc' ]; function demo($location, demoSvc) { /* jshint validthis:true */ var vm = this; vm.title = ''; vm.showDialog = function() { $('.myDialog').modal({ backdrop : 'static', keyboard : false }); } function datetimePicker() { $("#datepicker").kendoDatePicker({ culture : 'zh-CN' }); } function upload() { $("#files").kendoUpload({ async : { saveUrl : "/demo/save", removeUrl : "/demo/remove", autoUpload : true } }); } activate(); function activate() { datetimePicker(); upload(); } } })();

The code is as above. I would like to ask how it is loaded. Is the function inside already executed when it is loaded into this js?

習慣沉默
習慣沉默

reply all (2)
刘奇
(function(){ // })()

is equivalent to

var funcName = function(){ /// } funcName();

is equivalent to

function funcName(){ /// } funcName();

Is that so?

    为情所困
    (function(){ console.log(123) })()

    Self-executing function

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!