1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import { xor } from "lodash";
- import { browser } from "../../../application/browser";
- export class ActionManager {
- constructor() {
- this.actions = [];
- }
- push(action) {
- this.actions.push(action);
- }
- remove(genericObject) {
- const action = this.actions.find(action => action.genericObject == genericObject);
- const index = this.actions.indexOf(action);
- this.actions.splice(index, 1);
- }
- pop() {
- throw "Not implemented";
- }
- clear() {
- this.actions = [];
- }
- load(actions) {
- this.actions = actions;
- }
- save() {
- const LINES = [
- `# igeom: http://www.matematica.br!
- [ .: iGeom : Geometria Interativa na Internet :. ]!
- [ versao: 1.0.0 ]!
- [ PC = ${browser.appName}; DD = 0 ]!
- [[${new Date()}; ${browser.osName}]]!
- [0:1.1, 1:3, - iGeom versao 1.0.0]!\n`
- ];
- this.actions.forEach(action => {
- action.rehydrate();
- LINES.push(action.toString());
- });
- let file = new Blob([...LINES], {
- type: "text/plain;charset=utf-8"
- });
- return file;
- }
- }
|