Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
);
} 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."
)
);
}
}
}
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."
)
);
}
}
}
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')]);
});
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."
)
);
}
}
}
} = 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!"
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')]);
});
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',
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!')
);
}
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!')
);
}