Add FeaturesController for *.js and context for *.jsx
[MAILPOET-2008]
This commit is contained in:
4
assets/js/src/features/context.jsx
Normal file
4
assets/js/src/features/context.jsx
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import MailPoet from 'mailpoet';
|
||||||
|
|
||||||
|
export default React.createContext(MailPoet.FeaturesController);
|
7
assets/js/src/features_controller.js
Normal file
7
assets/js/src/features_controller.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
const FeaturesController = (config) => ({
|
||||||
|
isSupported: (feature) => {
|
||||||
|
return config[feature] || false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default FeaturesController;
|
@@ -1,5 +1,9 @@
|
|||||||
|
import FeaturesController from 'features_controller';
|
||||||
|
|
||||||
// A placeholder for MailPoet object
|
// A placeholder for MailPoet object
|
||||||
var MailPoet = {};
|
var MailPoet = {
|
||||||
|
FeaturesController: FeaturesController(window.mailpoet_feature_flags),
|
||||||
|
};
|
||||||
|
|
||||||
// Expose MailPoet globally
|
// Expose MailPoet globally
|
||||||
window.MailPoet = MailPoet;
|
window.MailPoet = MailPoet;
|
||||||
|
Reference in New Issue
Block a user