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

function syntax

New Here ,
Aug 20, 2019 Aug 20, 2019

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
388
Translate
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

Translate
Community Expert ,
Aug 20, 2019 Aug 20, 2019
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

Translate
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