How to use the cx/ui.History.pushState 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 / routes / default / index.js View on Github external
this.unsubscribe = watch(dashboardPath, (w, error) => {
            if (error) {
                Toast.create({
                    children:
                    "Error occurred while loading dashboard: " + error.toString(),
                    timeout: 10000,
                    mod: "error"
                }).open();
                console.log(error);
                History.pushState({}, null, "~/");
            } else {
                this.store.set("$page.dashboard", {
                    width: 80,
                    height: 40,
                    ...w
                });
                if (!isNonEmptyArray(w.widgets)) {
                    if (this.store.set('$page.add', true)) {
                        Toast.create({
                            children: 'Drag & drop widgets from the right sidebar on the board.',
                            timeout: 5000,
                            mod: "primary"
                        }).open();
                    }
                }
            }
github codaxy / dashboards / app / routes / users / EditorController.js View on Github external
deleteUser(userId).then(() => {
			History.pushState({}, null, "~/users");
		});
	}
github codaxy / tdo / app / routes / Controller.js View on Github external
boardTracker = new UserBoardTracker(userId, () => {
                    let boards = boardTracker.getActiveBoards();
                    this.store.set("boards", boards);

                    set("boards", boards);

                    if (!isNonEmptyArray(boards)) {
                        History.pushState({}, null, "~/new");
                    }
                    else if (get("url") == "~/")
                        History.pushState({}, null, "~/b/" + boards[0].id);
                });
github codaxy / tdo / app / routes / signIn / Controller.js View on Github external
this.addTrigger("userLogged", ["user.id"], userId => {
            if (!userId)
                return 
            History.pushState({}, null, "~/")    
        })
    }
github codaxy / tdo / app / routes / Controller.js View on Github external
onDeleteBoard(e, { store }) {
            let board = store.get("$board");
            boardTracker.update(board.id, {
                deleted: true,
                deletedDate: new Date().toISOString(),
                edit: false
            }, { suppressUpdate: true });
            boardTracker.reorder(true);
            boardTracker.forceUpdate();
            let boards = boardTracker.getActiveBoards();
            History.pushState({}, null, boards.length > 0 ? "~/b/" + boards[0].id : "~/")

            Toast.create({
                mod: 'warning',
                timeout: 3000,
                items: (
                    
                        <div>
                            </div>
                    
                )
            }).open();
        },
github codaxy / tdo / app / routes / keyboard-shortcuts.js View on Github external
let u2 = registerKeyboardShortcut({ keyCode: 191 }, (e) => {
        if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA")
            return;
        e.preventDefault();
        e.stopPropagation();
        if (!e.shiftKey) {
            let searchEl = document.getElementById("search");
            FocusManager.focusFirst(searchEl);
        }
        else {
            History.pushState({}, null, "~/help");
        }
    });
github codaxy / tdo / app / routes / keyboard-shortcuts.js View on Github external
let u4 = registerKeyboardShortcut({ keyCode: 221, ctrlKey: true }, (e) => {
        e.preventDefault();
        let { boards, $route } = store.getData();
        let boardInd = boards.findIndex(a => a.id == $route.boardId);
        if (boardInd + 1 >= boards.length) return;
        let nextBoard = boards[boardInd + 1];
        History.pushState({}, null, `~/b/${nextBoard.id}`);
    });
github codaxy / tdo / app / data / middleware / boardNavigation.js View on Github external
export default store => next => action => {
    switch (action.type) {

        case GOTO_BOARD:
            History.pushState({}, null, `~/b/${action.id}`);
            return;

        case GOTO_ANY_BOARD:
            if (action.forced || (window.location.hash || '#') == '#') {
                const {tdo} = store.getState();
                if (tdo.boards.length > 0)
                    History.pushState({}, null, `~/b/${tdo.boards[0].id}`);
            }
            return;

        default:
            return next(action);
    }
};
github codaxy / tdo / app / routes / Controller.js View on Github external
boardTracker = new UserBoardTracker(userId, () => {
                    let boards = boardTracker.getActiveBoards();
                    this.store.set("boards", boards);

                    set("boards", boards);

                    if (!isNonEmptyArray(boards)) {
                        History.pushState({}, null, "~/new");
                    }
                    else if (get("url") == "~/")
                        History.pushState({}, null, "~/b/" + boards[0].id);
                });