• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

function syntax

New Here ,
Aug 20, 2019 Aug 20, 2019

Copy link to clipboard

Copied

I took over an ActionScript job.

While getting familiar with the style of coding used I came across some syntax I don't quite understand.

I could not find the answer in the forums.

Here is a snippet of code:

(function () {

var __this = {};

createjs.EventDispatcher.initialize(__this);

window.eventSource = __this;

})();

Is this declaring a function as a class?

We are publishing as Canvas/HTML5.

Thank you,

Mike

TOPICS
ActionScript

Views

309

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 20, 2019 Aug 20, 2019

Hi.

This is not ActionScript. This is JavaScript.

And the code is a Self Executing Anonymous Function.

A JavaScript function that runs as soon as it is defined. Also known as an IIFE (Immediately Invoked Function Expression).

Self-Executing Anonymous Function - MDN Web Docs Glossary: Definitions of Web-related terms | MDN

What are Self-Invoking Anonymous Functions in JavaScript?

Regards,

JC

Votes

Translate

Translate
Community Expert ,
Aug 20, 2019 Aug 20, 2019

Copy link to clipboard

Copied

LATEST

Hi.

This is not ActionScript. This is JavaScript.

And the code is a Self Executing Anonymous Function.

A JavaScript function that runs as soon as it is defined. Also known as an IIFE (Immediately Invoked Function Expression).

Self-Executing Anonymous Function - MDN Web Docs Glossary: Definitions of Web-related terms | MDN

What are Self-Invoking Anonymous Functions in JavaScript?

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines