File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ var constructorFromRequireContext = require("./src/getConstructor/fromRequireCon
8
8
var constructorFromRequireContextWithGlobalFallback = require ( "./src/getConstructor/fromRequireContextWithGlobalFallback" )
9
9
var constructorFromRequireContextsWithGlobalFallback = require ( "./src/getConstructor/fromRequireContextsWithGlobalFallback" )
10
10
const { supportsHydration, reactHydrate, createReactRootLike } = require ( "./src/renderHelpers" )
11
- const { replaceNullWithUndefined } = require ( "./src/options" )
11
+ const { replaceNullWithUndefined, overwriteOption } = require ( "./src/options" )
12
12
13
13
var ReactRailsUJS = {
14
14
// This attribute holds the name of component which should be mounted
@@ -37,6 +37,10 @@ var ReactRailsUJS = {
37
37
replaceNull : false ,
38
38
} ,
39
39
40
+ setOptions : function ( newOptions ) {
41
+ overwriteOption ( ReactRailsUJS . options , newOptions , "replaceNull" )
42
+ } ,
43
+
40
44
// helper method for the mount and unmount methods to find the
41
45
// `data-react-class` DOM elements
42
46
findDOMNodes : function ( searchSelector ) {
Original file line number Diff line number Diff line change @@ -11,3 +11,8 @@ export function replaceNullWithUndefined(obj) {
11
11
} )
12
12
return obj
13
13
}
14
+
15
+ export function overwriteOption ( ujsOptions , newOptions , key ) {
16
+ if ( ! Object . prototype . hasOwnProperty . call ( newOptions , key ) ) return
17
+ ujsOptions [ key ] = newOptions [ key ]
18
+ }
You can’t perform that action at this time.
0 commit comments