コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

Example of javascript event and adaptTo?

Avatar

Level 4

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

1 受け入れられたソリューション

Avatar

正解者
Community Advisor

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 返信

Avatar

正解者
Community Advisor

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

Avatar

Level 4

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');

     ...

}