@ JsOverlay public final void initData ( boolean useFactory , Set < String > fieldNames ) { JsPropertyMap < Object > dataFields = JsPropertyMap . of ( ) ; dataFieldsToProxy = new HashSet <> ( ) ; for ( String fieldName : fieldNames ) { dataFields . set ( fieldName , null ) ; // If field name starts with $ or _ Vue.js won't proxify it so we must do it if ( fieldName . startsWith ( "$" ) || fieldName . startsWith ( "_" ) ) { dataFieldsToProxy . add ( fieldName ) ; } } if ( useFactory ) { String dataFieldsJSON = JSON . stringify ( dataFields ) ; this . setData ( ( DataFactory ) ( ) -> JSON . parse ( dataFieldsJSON ) ) ; } else { this . setData ( ( DataFactory ) ( ) -> dataFields ) ; } }
Initialise the data structure then set it to either a Factory or directly on the Component .