Example of javascript event and adaptTo? | Community
Skip to main content
Level 4
May 11, 2018 2:06 PM UTC
Solved

Example of javascript event and adaptTo?

With Granite UI, when I handle a client-side js event of type 'foundation-field-change', what should the code look like to adapt the data to the underlying object?

For example, my callback function signature is,

     $(document).on('foundation-field-change', function(event) {...}  

I want to do some work involving the changed field - how do i get to it/adapt to it?  Docs are here foundation-field — Granite UI 1.0 documentation but I need a little more help.

thanks Joe

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Peter_Puzanovs
Peter_PuzanovsAccepted solution
New Participant
May 11, 2018 2:32 PM UTC

Dear Dorian,

As per javasccript API, we have adaptTo method registered to jQuery provided by Adobe.

Therefore you call:

$(window).adaptTo("foundation-registry") in this example we adapt window to foundation-registry.

Regards,

Peter

2 replies

Level 4
May 11, 2018 4:43 PM UTC

Thanks PuzanovsP,

Does the following sound correct?  For an event, if the docs describe its adaptTo type as 'foundation-field' I should be able to write,

$(document).on('foundation-field-change', function(event) {

     var f = $(event).adaptTo('foundation-field');

     ...

} 

Translate
Peter_Puzanovs
Peter_PuzanovsAccepted solution
New Participant
May 11, 2018 2:32 PM UTC

Dear Dorian,

As per javasccript API, we have adaptTo method registered to jQuery provided by Adobe.

Therefore you call:

$(window).adaptTo("foundation-registry") in this example we adapt window to foundation-registry.

Regards,

Peter

Translate