Receive a callback whenever the SDK gets back the current list of available NamiCampaign objects for the device. This list is personalized for the device by the Nami backend server based upon campaign filtering and priority rules.
NamiCampaignManager.registerAvailableCampaignsHandler { campaigns in }
NamiCampaignManager.registerAvailableCampaignsHandler() { availableCampaigns -> }
import 'package:nami_flutter/campaign/nami_campaign.dart'; import 'package:nami_flutter/campaign/nami_campaign_manager.dart'; List<NamiCampaign> _campaigns = []; NamiCampaignManager.registerAvailableCampaignsHandler().listen((list) { setState(() { _campaigns = list; }); });
import {NamiCampaignManager, NamiCampaign} from 'react-native-nami-sdk'; useEffect(() => { const subscriptionRemover = NamiCampaignManager.registerAvailableCampaignsHandler( (availableCampaigns) => { console.log('availableCampaigns', availableCampaigns); setCampaigns(availableCampaigns); }, ); return () => { subscriptionRemover(); }; }, []);
Last updated 6 months ago