123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- //"use strict";
- /*
- The MIT License (MIT)
- Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contributors. (https://github.com/NikolaySuslov/livecodingspace/blob/master/LICENSE.md)
- */
- // VWF & Ohm view driver
- import {Fabric} from '/core/vwf/fabric.js';
- class OhmViewDriver extends Fabric {
- constructor(module) {
- console.log("OhmViewDriver constructor");
- super(module, 'View');
- }
- factory() {
- let _self_ = this;
- return this.load(this.module,
- {
- // == Module Definition ====================================================================
-
- initialize: function (options) {
- let self = this;
- this.fabric = _self_;
- this.nodes = {};
-
- },
-
- // initializedNode: function( nodeID, childID ) {
- // },
-
- createdProperty: function (nodeId, propertyName, propertyValue) {
- return this.satProperty(nodeId, propertyName, propertyValue);
- },
-
- initializedProperty: function (nodeId, propertyName, propertyValue) {
- return this.satProperty(nodeId, propertyName, propertyValue);
- },
-
- satMethod: function (nodeId, methodName) {
-
- let self = this;
-
- var node = this.state.nodes[ nodeId ];
-
- if ( !( node && node.lang) ) {
- return;
- }
- if (methodName.indexOf("Operation") > -1) {
-
-
- //self.kernel.callMethod (nodeId, methodName);
- self.kernel.setProperty(nodeId, 'ohmLang', node.lang.source);
- console.log("set new lang properties");
- }
-
- },
-
- // createdMethod: function( nodeId, methodName, methodParameters, methodBody) {
-
- // var self = this;
- // var node = this.state.nodes[ nodeId ];
- // if ( !( node && node.lang) ) {
- // return;
- // }
-
- // if (methodName.indexOf("Operation") > -1) {
-
- // console.log("add semantic operations");
- // self.kernel.callMethod (nodeId, methodName);
-
- // }
-
- // },
-
- satProperty: function (nodeId, propertyName, propertyValue) {
-
- let self = this;
- var node = this.state.nodes[ nodeId ];
- if ( !( node && node.lang) ) {
- return;
- }
- var lang = node.lang;
- switch (propertyName) {
- case "ohmLang":
- if (propertyValue) {
- self.kernel.callMethod (nodeId, 'initLang');
- }
- break;
- }
-
- },
-
- // firedEvent: function (nodeID, eventName, eventParameters) {
- // },
-
-
- // ticked: function (vwfTime) {
- // }
-
- });
-
- }
- }
- export { OhmViewDriver as default }
|