Topic
  • 6 replies
  • Latest Post - ‏2013-02-06T15:02:25Z by SystemAdmin
SystemAdmin
SystemAdmin
2327 Posts

Pinned topic About WL Adapter: How to call function from other js file

‏2013-01-30T12:02:46Z |
Hello.

i want to call function from other js file like node.js.
For example,
http://stackoverflow.com/questions/5797852/in-node-js-how-do-i-include-functions-from-my-other-files
Dose not Worklight Adapter support like this?
Are there any options? To define and call other HTTP adapter or Java Class(Java Adapter) ?
  • ShmulikB
    ShmulikB
    20 Posts

    Re: About WL Adapter: How to call function from other js file

    ‏2013-01-30T12:27:00Z  
    Hello,
    There is a way to to call a Java Class from an adapter.
    See Module 5.5 - Using Java™ in Adapters
    (ftp://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v505/Module_05_5_-_Using_Java_in_Adapters.pdf)
  • ShmulikB
    ShmulikB
    20 Posts

    Re: About WL Adapter: How to call function from other js file

    ‏2013-01-30T13:27:06Z  
    See also Module 6.1 - Advanced Adapter Usage and Mashup
    (ftp://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v505/Module_06_1_-_Advanced_Adapter_Usage_and_Mashup.pdf)
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: About WL Adapter: How to call function from other js file

    ‏2013-02-04T10:59:23Z  
    • ShmulikB
    • ‏2013-01-30T13:27:06Z
    See also Module 6.1 - Advanced Adapter Usage and Mashup
    (ftp://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v505/Module_06_1_-_Advanced_Adapter_Usage_and_Mashup.pdf)
    Thank you for your reply.

    i want to use JavaScript library, for example, data validation library which is already developed.
    In this case, i need to copy all source in adapter's impl.js file?
  • raanan
    raanan
    50 Posts

    Re: About WL Adapter: How to call function from other js file

    ‏2013-02-05T07:07:09Z  
    Hi.

    Right now Adapters support only one JavaScript file, so if you wish to use an external file you will need to copy and paste the code into the existing JavaScript file.
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: About WL Adapter: How to call function from other js file

    ‏2013-02-06T00:57:52Z  
    Thank you.
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: About WL Adapter: How to call function from other js file

    ‏2013-02-06T15:02:25Z  
    Thank you.
    This is server side JavaScript and it will be compiled into Java byte code. Call other client side JavaScript is not possible. But you could call Java classes to achieve reuse.

    Jerry