ohm.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. "use strict";
  2. // VWF & A-Frame view driver
  3. // Copyright 2017 Krestianstvo.org project
  4. //
  5. // Copyright 2012 United States Government, as represented by the Secretary of Defense, Under
  6. // Secretary of Defense (Personnel & Readiness).
  7. //
  8. // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  9. // in compliance with the License. You may obtain a copy of the License at
  10. //
  11. // http://www.apache.org/licenses/LICENSE-2.0
  12. //
  13. // Unless required by applicable law or agreed to in writing, software distributed under the License
  14. // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  15. // or implied. See the License for the specific language governing permissions and limitations under
  16. // the License.
  17. /// vwf/view/lesson creates a view interface for instruction text.
  18. ///
  19. /// @module vwf/view/aframe
  20. /// @requires vwf/view
  21. define(["module", "vwf/view"], function (module, view) {
  22. return view.load(module, {
  23. // == Module Definition ====================================================================
  24. initialize: function (options) {
  25. var self = this;
  26. this.nodes = {};
  27. },
  28. // initializedNode: function( nodeID, childID ) {
  29. // },
  30. createdProperty: function (nodeId, propertyName, propertyValue) {
  31. return this.satProperty(nodeId, propertyName, propertyValue);
  32. },
  33. initializedProperty: function (nodeId, propertyName, propertyValue) {
  34. return this.satProperty(nodeId, propertyName, propertyValue);
  35. },
  36. satMethod: function (nodeId, methodName) {
  37. var self = this;
  38. var node = this.state.nodes[ nodeId ];
  39. if ( !( node && node.lang) ) {
  40. return;
  41. }
  42. if (methodName.indexOf("Operation") > -1) {
  43. //self.kernel.callMethod (nodeId, methodName);
  44. self.kernel.setProperty(nodeId, 'ohmLang', node.lang.source);
  45. console.log("set new lang properties");
  46. }
  47. },
  48. // createdMethod: function( nodeId, methodName, methodParameters, methodBody) {
  49. // var self = this;
  50. // var node = this.state.nodes[ nodeId ];
  51. // if ( !( node && node.lang) ) {
  52. // return;
  53. // }
  54. // if (methodName.indexOf("Operation") > -1) {
  55. // console.log("add semantic operations");
  56. // self.kernel.callMethod (nodeId, methodName);
  57. // }
  58. // },
  59. satProperty: function (nodeId, propertyName, propertyValue) {
  60. var self = this;
  61. var node = this.state.nodes[ nodeId ];
  62. if ( !( node && node.lang) ) {
  63. return;
  64. }
  65. var lang = node.lang;
  66. switch (propertyName) {
  67. case "ohmLang":
  68. if (propertyValue) {
  69. self.kernel.callMethod (nodeId, 'initLang');
  70. }
  71. break;
  72. }
  73. },
  74. // firedEvent: function (nodeID, eventName, eventParameters) {
  75. // },
  76. // ticked: function (vwfTime) {
  77. // }
  78. });
  79. });