@@ -112,6 +112,47 @@ Once some records has been loaded they are also cached in the DataStore, you can
112112records = store.getAll('User')
113113```
114114
115+ ### Hooks
116+
117+ Sometime you want to be able to do some custom additional serialization / deserialization.
118+
119+ #### By using the adapter
120+
121+ ``` js
122+ const jsonApiAdapter = new JsonApiAdapter ({
123+ store: store,
124+ beforeDeserialize : function (mapper , data , opts ) { return data; }
125+ afterDeserialize : function (mapper , data , opts ) { return data; }
126+ beforeSerialize : function (mapper , data , opts ) { return data; }
127+ afterSerialize : function (mapper , data , opts ) { return data; }
128+ });
129+ ```
130+
131+ #### By using the mapper
132+
133+ ``` js
134+ const UserMapper = store .defineMapper (' User' , {
135+ beforeDeserialize : function (mapper , data , opts ) { return data; }
136+ afterDeserialize : function (mapper , data , opts ) { return data; }
137+ beforeSerialize : function (mapper , data , opts ) { return data; }
138+ afterSerialize : function (mapper , data , opts ) { return data; }
139+ });
140+ ```
141+
142+ #### When doing requests
143+
144+ ``` js
145+ store .findAll (' User' , {}, {
146+ beforeDeserialize : function (mapper , data , opts ) { return data; }
147+ afterDeserialize : function (mapper , data , opts ) { return data; }
148+ });
149+
150+ store .update (' User' , {}, {
151+ beforeSerialize : function (mapper , data , opts ) { return data; }
152+ afterSerialize : function (mapper , data , opts ) { return data; }
153+ });
154+ ```
155+
115156
116157### Get JSONApi Meta
117158
0 commit comments