Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

On our end, we define a function for each desired event, then we we bind that function to the event:


const sdk = require('kinvey-flex-sdk');

sdk.service((err, flex)=>{

const data = flex.data;// gets the FlexData object from the service

function getRecordById(context, complete, modules){

// flex function implementation


}


// set the serviceObject

const widgets = data.serviceObject('widgets');


// wire up the event that we want to process

widgets.onGetById(getRecordById);

});


Flex Functions

Flex functions are used to execute custom code by either hooks, or in our case, endpoints.

...