Skip to content

Add onLoaded function to MMGIS API#73

Merged
ac-61 merged 3 commits into
developmentfrom
on-loaded
Jul 1, 2021
Merged

Add onLoaded function to MMGIS API#73
ac-61 merged 3 commits into
developmentfrom
on-loaded

Conversation

@ac-61
Copy link
Copy Markdown
Contributor

@ac-61 ac-61 commented Jul 1, 2021

This adds an onLoaded function to the MMGIS API, which calls the input function once MMGIS has finished loading.

An example of how to call the onLoaded function:

window.mmgisAPI.onLoaded(() => { 
    // Add listener with MMGIS API now that MMGIS has finished loading
    function listener() {
        const featuresContained = window.mmgisAPI.featuresContained()
        console.log('featuresContained', featuresContained)
        const activeFeature = window.mmgisAPI.getActiveFeature()
        console.log('activeFeature', activeFeature)
    }
    window.mmgisAPI.addEventListener('onPan', listener)
})

@ac-61 ac-61 requested review from fcalef and tariqksoliman July 1, 2021 17:58
Comment thread src/essence/mmgisAPI/mmgisAPI.js Outdated
Copy link
Copy Markdown
Member

@tariqksoliman tariqksoliman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now!

@ac-61 ac-61 merged commit 4a76aaa into development Jul 1, 2021
@ac-61 ac-61 deleted the on-loaded branch July 1, 2021 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants