Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Feature/event name mapping #480

Merged
merged 12 commits into from
Mar 24, 2021
Merged

Feature/event name mapping #480

merged 12 commits into from
Mar 24, 2021

Conversation

amiceli
Copy link
Contributor

@amiceli amiceli commented Jul 30, 2020

It adds an option eventMapping like eventToActionTransformer who allow to map event name from socket io event data.

An example :

// a socket io event example
{ name : 'event', data : { task : 'synchronize', progress : 90 } }
const options = {
    eventMapping : (eventName, args) => {
        const data = args[0]

        return data.task
    }
}

Vue.use(VueSocketIOExt, socket, options);

And in vue component :

export default {
    sockets : {
        synchronize () {
            console.log ('progress received')
        }
    }
}

You're welcome if you have any feedbacks.

@amiceli
Copy link
Contributor Author

amiceli commented Aug 14, 2020

Any news about merging ?
Thanks.

@probil
Copy link
Owner

probil commented Mar 22, 2021

@amiceli That's a good idea. Few nuances though:

  • there are linter issue (requires a simple code style fix)
  • dist/ shouldn't be committed

Will fix and merge tomorrow morning if you don't have time to deal with it

@amiceli
Copy link
Contributor Author

amiceli commented Mar 22, 2021

@probil I will check it today.

@codecov
Copy link

codecov bot commented Mar 22, 2021

Codecov Report

Merging #480 (78847f2) into master (33976fc) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #480   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          128       131    +3     
  Branches        20        21    +1     
=========================================
+ Hits           128       131    +3     
Impacted Files Coverage Δ
src/Observe.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33976fc...78847f2. Read the comment docs.

@amiceli
Copy link
Contributor Author

amiceli commented Mar 23, 2021

@probil Everything seems to be ok.

@probil
Copy link
Owner

probil commented Mar 24, 2021

@amiceli Could you apply this small suggestion regarding types?

Co-authored-by: Max Lyashuk <m_lyashuk@ukr.net>
@amiceli
Copy link
Contributor Author

amiceli commented Mar 24, 2021

@probil done.

@probil probil merged commit ad6e309 into probil:master Mar 24, 2021
@github-actions
Copy link

🎉 This PR is included in version 4.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@amiceli amiceli deleted the feature/event-name-mapping branch March 25, 2021 16:31
@github-actions
Copy link

github-actions bot commented Apr 2, 2021

🎉 This PR is included in version 5.0.0-alpha.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants