Skip to content

Commit

Permalink
Add support to some serialisations and deserialisations.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-wu committed Jun 20, 2019
1 parent 404f2de commit 8ed08d3
Show file tree
Hide file tree
Showing 12 changed files with 497 additions and 133 deletions.
51 changes: 41 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@
"file-loader": "^1.1.11",
"html-loader": "^0.5.5",
"jquery": "^3.4.1",
"lodash": ">=4.17.11",
"lodash": "^4.17.11",
"polyfill-array-includes": "^2.0.0",
"query-string": "^5.1.1",
"raw-loader": "^0.5.1",
"style-loader": "^0.21.0",
"url-loader": "^1.0.1",
"webpack": "^4.6.0",
"webpack-cli": "^2.1.2",
"webpack-jquery-ui": "^1.0.0",
"zincjs": "^0.29.11",
"polyfill-array-includes": "^2.0.0"
"js-yaml": ">=3.13.1"
},
"dependencies": {}
}
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports.ManagerSidebar = require("./ui/ManagerSidebar").ManagerSidebar;
exports.ModuleManager = require("./utilities/manager").ModuleManager;
exports.MANAGER_ITEM_CHANGE = require("./utilities/managerItem").MANAGER_ITEM_CHANGE;
exports.MODULE_CHANGE = require("./modules/BaseModule").MODULE_CHANGE;
exports.FragmentParser = require("./utilities/fragmentParser").FragmentParser;
//exports.ChartDialog = require("./ui/ChartDialog").ChartDialog;
//exports.CellPanelDialog = require("./ui/CellPanelDialog").CellPanelDialog;
exports.VERSION = '0.2.0';
25 changes: 23 additions & 2 deletions src/modules/BaseModule.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var MODULE_CHANGE = { ALL: 0, DESTROYED: 1, NAME_CHANGED: 2 };

var MODULE_CHANGE = { ALL: 0, DESTROYED: 1, NAME_CHANGED: 2, SETTINGS_CHANGED: 3 };

var BaseModule = function() {
this.typeName = "Base Module";
Expand All @@ -20,6 +19,28 @@ BaseModule.prototype.setName = function(name) {
}
}

BaseModule.prototype.settingsChanged = function() {
var callbackArray = this.onChangedCallbacks.slice();
for (var i = 0; i < callbackArray.length; i++) {
callbackArray[i]( this, MODULE_CHANGE.SETTINGS_CHANGED );
}
}

BaseModule.prototype.exportSettings = function() {
var settings = {};
settings.dialog = this.typeName;
settings.name = this.instanceName;
return settings;
}

BaseModule.prototype.importSettings = function(settings) {
if (settings.dialog == this.typeName) {
this.setName(settings.name);
return true;
}
return false;
}

BaseModule.prototype.publishChanges = function(annotations, eventType) {
for (var i = 0; i < this.eventNotifiers.length; i++) {
this.eventNotifiers[i].publish(this, eventType, annotations);
Expand Down

0 comments on commit 8ed08d3

Please sign in to comment.