How to use the cx/data.Store function in cx

To help you get started, we’ve selected a few cx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codaxy / dashboards / app / index.js View on Github external
import { Store } from "cx/data";
import { Url, History, Widget, startAppLoop } from "cx/ui";
import { Timing, Debug } from "cx/util";
//css
import "./index.scss";
import "cx-theme-aquamarine";

//store
const store = new Store();

//webpack (HMR)
if (module.hot) {
	// accept itself
	module.hot.accept();

	// remember data on dispose
	module.hot.dispose(function(data) {
		data.state = store.getData();
		if (stop) stop();
	});

	//apply data on hot replace
	if (module.hot.data) store.load(module.hot.data.state);
}
github codaxy / tdo / app / index.js View on Github external
import { startHotAppLoop, History } from "cx/ui";
import { Debug } from "cx/util";
import Routes from "./routes";
import "./index.scss";

import { Store } from "cx/data";
const store = new Store();

History.connect(
  store,
  "url"
);

Debug.enable("app-data");

startHotAppLoop(module, document.getElementById("app"), store, Routes);