How to use the @casual-simulation/aux-common.toast function in @casual-simulation/aux-common

To help you get started, we’ve selected a few @casual-simulation/aux-common 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 casual-simulation / aux / src / aux-server / aux-web / aux-projector / BuilderGameView / BuilderGameView.ts View on Github external
)
                );
            } catch (ex) {
                console.error('[BuilderGameView] Paste failed', ex);
                appManager.simulationManager.primary.helper.transaction(
                    toast(
                        "Couldn't paste your clipboard. Have you copied a selection or worksurface?"
                    )
                );
            }
        } else {
            console.error(
                "[BuilderGameView] Browser doesn't support clipboard API!"
            );
            appManager.simulationManager.primary.helper.transaction(
                toast(
                    "Sorry, but your browser doesn't support pasting files from a selection or worksurface."
                )
            );
        }
    }
}
github casual-simulation / aux / src / aux-server / aux-web / aux-projector / BuilderGameView / BuilderGameView.ts View on Github external
options.y = gridPosition.y;
                    options.z = 0;
                }

                appManager.simulationManager.primary.helper.transaction(
                    pasteState(tree.value, options),
                    toast(
                        `${fileIds.length} ${
                            fileIds.length === 1 ? 'file' : 'files'
                        } pasted!`
                    )
                );
            } catch (ex) {
                console.error('[BuilderGameView] Paste failed', ex);
                appManager.simulationManager.primary.helper.transaction(
                    toast(
                        "Couldn't paste your clipboard. Have you copied a selection or worksurface?"
                    )
                );
            }
        } else {
            console.error(
                "[BuilderGameView] Browser doesn't support clipboard API!"
            );
            appManager.simulationManager.primary.helper.transaction(
                toast(
                    "Sorry, but your browser doesn't support pasting files from a selection or worksurface."
                )
            );
        }
    }
}
github casual-simulation / aux / src / aux-vm / vm / AuxHelper.spec.ts View on Github external
it('should emit local events that are sent via transaction()', async () => {
            let events: LocalEvents[] = [];
            helper.localEvents.subscribe(e => events.push(...e));

            await helper.transaction(toast('test'));

            expect(events).toEqual([toast('test')]);
        });
github casual-simulation / aux / src / aux-server / aux-web / aux-projector / BuilderGameView / BuilderGameView.ts View on Github external
options.y = gridPosition.y;
                    options.z = 0;
                }

                appManager.simulationManager.primary.helper.transaction(
                    pasteState(tree.value, options),
                    toast(
                        `${fileIds.length} ${
                            fileIds.length === 1 ? 'file' : 'files'
                        } pasted!`
                    )
                );
            } catch (ex) {
                console.error('[BuilderGameView] Paste failed', ex);
                appManager.simulationManager.primary.helper.transaction(
                    toast(
                        "Couldn't paste your clipboard. Have you copied a selection or worksurface?"
                    )
                );
            }
        } else {
            console.error(
                "[BuilderGameView] Browser doesn't support clipboard API!"
            );
            appManager.simulationManager.primary.helper.transaction(
                toast(
                    "Sorry, but your browser doesn't support pasting files from a selection or worksurface."
                )
            );
        }
    }
}
github casual-simulation / aux / src / aux-server / aux-web / aux-projector / BuilderGameView / BuilderGameView.ts View on Github external
} = interaction.pointOnWorkspaceGrid(
                    calc,
                    this._game.getInput().getMousePagePos()
                );
                if (good) {
                    options.context = interaction.firstContextInWorkspace(
                        workspace
                    );
                    options.x = gridPosition.x;
                    options.y = gridPosition.y;
                    options.z = 0;
                }

                appManager.simulationManager.primary.helper.transaction(
                    pasteState(tree.value, options),
                    toast(
                        `${fileIds.length} ${
                            fileIds.length === 1 ? 'file' : 'files'
                        } pasted!`
                    )
                );
            } catch (ex) {
                console.error('[BuilderGameView] Paste failed', ex);
                appManager.simulationManager.primary.helper.transaction(
                    toast(
                        "Couldn't paste your clipboard. Have you copied a selection or worksurface?"
                    )
                );
            }
        } else {
            console.error(
                "[BuilderGameView] Browser doesn't support clipboard API!"
github casual-simulation / aux / src / aux-vm / vm / AuxHelper.spec.ts View on Github external
it('should emit local events from actions', async () => {
            let events: LocalEvents[] = [];
            helper.localEvents.subscribe(e => events.push(...e));

            await helper.createFile('test', {
                'action()': 'player.toast("test")',
            });

            await helper.transaction(action('action', ['test'], 'user'));

            expect(events).toEqual([toast('test')]);
        });
github casual-simulation / aux / src / aux-server / aux-web / aux-player / CheckoutForm / CheckoutForm.ts View on Github external
private async _initForm() {
        const key = getStripeKey(this._checkoutSim);
        const hasKey = hasValue(key);
        if (!hasKey) {
            this._checkoutSim.helper.transaction(
                toast(
                    'A stripe key must be provided before checkouts will work.'
                )
            );
        } else if (this.showCheckoutDialog) {
            this._checkoutSim.helper.transaction(
                toast('A checkout is already underway.')
            );
        } else {
            await loadStripe();

            this._stripe = Stripe(key);
            const elements = this._stripe.elements();

            this._card = elements.create('card', {
                classes: {
                    base: 'card-element',
github casual-simulation / aux / src / aux-server / aux-web / aux-projector / BuilderGameView / BuilderGameView.ts View on Github external
private async _copySelection() {
        const sim = appManager.simulationManager.primary;
        const files = sim.selection.getSelectedFilesForUser(
            sim.helper.userFile
        );
        if (files.length === 0) {
            appManager.simulationManager.primary.helper.transaction(
                toast('Nothing selected to copy!')
            );
            return;
        }

        await copyFilesFromSimulation(sim, files);

        appManager.simulationManager.primary.helper.transaction(
            toast('Selection Copied!')
        );
    }
github casual-simulation / aux / src / aux-server / aux-web / aux-projector / BuilderGameView / BuilderGameView.ts View on Github external
private async _copySelection() {
        const sim = appManager.simulationManager.primary;
        const files = sim.selection.getSelectedFilesForUser(
            sim.helper.userFile
        );
        if (files.length === 0) {
            appManager.simulationManager.primary.helper.transaction(
                toast('Nothing selected to copy!')
            );
            return;
        }

        await copyFilesFromSimulation(sim, files);

        appManager.simulationManager.primary.helper.transaction(
            toast('Selection Copied!')
        );
    }