Difference between flight.component() and defineComponent()

53 views
Skip to first unread message

Bogdan Begovic

unread,
Sep 11, 2014, 7:43:11 AM9/11/14
to twitter...@googlegroups.com
I have been using Flight since version 1.1.1 and, for creating new components, I have been using a new require module that returns function defineComponent() with constructor and mixins as parameters. Today a have seen this flight.component() construction of components in a page.

So I wanted to ask if anyone can explain to me what is going on here, will defineComponent be deprecated and when to use one or the other?

Gabriel Pugliese

unread,
Sep 11, 2014, 7:50:16 AM9/11/14
to Bogdan Begovic, twitter...@googlegroups.com
It's just namespacing. 
When you use "define(['flight/lib/component'], function (PARAM)...", the PARAM can be any string and is defined only inside the scope of the function. In examples they named it defineComponent.
But if you use flight without an AMD lib (like using a script tag), "flight" is a global var that has the method "component", that is exactly the same of the "defineComponent" function. (flight.component === defineComponent)

Hope this is clear enough





Gabriel Pugliese
CodersTV.com
@coderstv

Bogdan Begovic

unread,
Sep 11, 2014, 9:42:51 AM9/11/14
to twitter...@googlegroups.com, bogdan...@gmail.com
@Gabriel Thanks, wasn't aware of this :)
Reply all
Reply to author
Forward
0 new messages