From 2a789c4dd9dc90e08a46605a897d0283dd21ad83 Mon Sep 17 00:00:00 2001 From: Nav Patel Date: Wed, 5 Jul 2017 14:50:55 +0530 Subject: [PATCH] See https://github.com/facebook/flux/issues/351. Fix is based on https://github.com/facebook/flux/issues/351#issuecomment-243175376 --- index.js | 14 ++++++++++++++ package.json | 26 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 index.js create mode 100644 package.json diff --git a/index.js b/index.js new file mode 100644 index 0000000..045edf6 --- /dev/null +++ b/index.js @@ -0,0 +1,14 @@ +// Based on https://github.com/facebook/flux/issues/351#issuecomment-243175376 + +const flux_utils = require('flux/utils') + +module.exports = function FluxContainerCreate(containerClass) { + const tmp = containerClass; + containerClass = function(...args) { + return new tmp(...args); + }; + containerClass.prototype = tmp.prototype; + containerClass.getStores = tmp.getStores; + containerClass.calculateState = tmp.calculateState; + return flux_utils.Container.create(containerClass); +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..df4ddf4 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "flux-container-create", + "version": "1.0.0", + "description": "Workaround for https://github.com/facebook/flux/issues/351, based on lazy8's code'", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Nav Patel ", + "license": "ISC", + "dependencies": { + "flux": "^3.1.2" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/patelnav/flux-container-create.git" + }, + "keywords": [ + "react", + "flux" + ], + "bugs": { + "url": "https://github.com/patelnav/flux-container-create/issues" + }, + "homepage": "https://github.com/patelnav/flux-container-create#readme" +}