altjs / utils

A collection of utils for alt.js
37 stars 25 forks source link

Immutable onDeserialize/onSerialize override #21

Open palasjir opened 7 years ago

palasjir commented 7 years ago

Hi,

I think there is missconception while using ImmutableUtil.js. When overriding onSerialize/onDeserialize in store:

import immutable from 'alt-utils/lib/ImmutableUtils'

class MyStore {
  static config = {
     onSerialize: state => {
         ...    
     },
     onDeserialize: data => {
        ... 
    }
 }
  ...
}

and calling immutable(MyStore) it uses default onSerialize and onDeserialize methods defined in immutable. It's possible to use in right way by calling immutable(MyStore, MyStore.config). Wouldn't it be nice to use the new methods to override defaults?