@@ -111,6 +111,8 @@ options:
111111 If true, forwards input messages to the output
112112 [storeFrontEndInputAsState] - boolean (default true).
113113 If true, any message received from front-end is stored as state
114+ [persistantFrontEndValue] - boolean (default true).
115+ If true, last received message is send again when front end reconnect.
114116
115117 [convert] - callback to convert the value before sending it to the front-end
116118 [beforeEmit] - callback to prepare the message that is emitted to the front-end
@@ -131,6 +133,9 @@ function add(opt) {
131133 if ( typeof opt . storeFrontEndInputAsState === 'undefined' ) {
132134 opt . storeFrontEndInputAsState = true ;
133135 }
136+ if ( typeof opt . persistantFrontEndValue === 'undefined' ) {
137+ opt . persistantFrontEndValue = true ;
138+ }
134139 opt . convert = opt . convert || noConvert ;
135140 opt . beforeEmit = opt . beforeEmit || beforeEmit ;
136141 opt . convertBack = opt . convertBack || noConvert ;
@@ -248,7 +253,9 @@ function add(opt) {
248253 // Emit and Store the data
249254 //if (settings.verbose) { console.log("UI-EMIT",JSON.stringify(toEmit)); }
250255 emitSocket ( updateValueEventName , toEmit ) ;
251- replayMessages [ opt . node . id ] = toStore ;
256+ if ( opt . persistantFrontEndValue ) {
257+ replayMessages [ opt . node . id ] = toStore ;
258+ }
252259
253260 // Handle the node output
254261 if ( opt . forwardInputMessages && opt . node . _wireCount ) {
@@ -270,7 +277,9 @@ function add(opt) {
270277 var converted = opt . convertBack ( msg . value ) ;
271278 if ( opt . storeFrontEndInputAsState === true ) {
272279 currentValues [ msg . id ] = converted ;
273- replayMessages [ msg . id ] = msg ;
280+ if ( opt . persistantFrontEndValue ) {
281+ replayMessages [ msg . id ] = msg ;
282+ }
274283 }
275284 var toSend = { payload :converted } ;
276285 toSend = opt . beforeSend ( toSend , msg ) || toSend ;
0 commit comments