model.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. /*
  2. The MIT License (MIT)
  3. Copyright (c) 2014-2020 Nikolai Suslov and the Krestianstvo.org project contributors. (https://github.com/NikolaySuslov/livecodingspace/blob/master/LICENSE.md)
  4. Virtual World Framework Apache 2.0 license (https://github.com/NikolaySuslov/livecodingspace/blob/master/licenses/LICENSE_VWF.md)
  5. */
  6. /// Model API.
  7. ///
  8. /// @module vwf/api/model
  9. class ModelApi {
  10. constructor() {
  11. //console.log("Model constructor");
  12. /// Description.
  13. ///
  14. /// @function
  15. ///
  16. /// @param {ID} nodeID
  17. /// @param {ID} childID
  18. /// @param {String} childExtendsID
  19. /// @param {String[]} childImplementsIDs
  20. /// @param {String} childSource
  21. /// @param {String} childType
  22. /// @param {String} childIndex
  23. /// When `nodeID` is falsy, the URI of the component, or `undefined` if the component
  24. /// wasn't loaded from a URI. When `nodeID` is truthy, the numerical index of the child's
  25. /// position in the parent's array, starting at `0`. When child order is significant to
  26. /// the driver, the child should be placed at the given position in the parent's array.
  27. /// Nodes won't necessarily arrive in numerical order since varying dependencies cause
  28. /// nodes to become ready at indeterminate times.
  29. /// @param {String} childName
  30. /// @param {module:vwf/api/model~readyCallback} callback
  31. ///
  32. /// @returns {}
  33. this.creatingNode = [ /* nodeID, childID, childExtendsID, childImplementsIDs, childSource, childType,
  34. childIndex, childName, callback( ready ) */ ]
  35. /// Description.
  36. ///
  37. /// @function
  38. ///
  39. /// @param {ID} nodeID
  40. /// @param {ID} childID
  41. /// @param {String} childExtendsID
  42. /// @param {String[]} childImplementsIDs
  43. /// @param {String} childSource
  44. /// @param {String} childType
  45. /// @param {String} childIndex
  46. /// When `nodeID` is falsy, the URI of the component, or `undefined` if the component
  47. /// wasn't loaded from a URI. When `nodeID` is truthy, the numerical index of the child's
  48. /// position in the parent's array, starting at `0`. When child order is significant to
  49. /// the driver, the child should be placed at the given position in the parent's array.
  50. /// Nodes won't necessarily arrive in numerical order since varying dependencies cause
  51. /// nodes to become ready at indeterminate times.
  52. /// @param {String} childName
  53. ///
  54. /// @returns {}
  55. this.initializingNode = [ /* nodeID, childID, childExtendsID, childImplementsIDs, childSource, childType,
  56. childIndex, childName */ ]
  57. /// Description.
  58. ///
  59. /// @function
  60. ///
  61. /// @param {ID} nodeID
  62. /// @param {ID} childID
  63. /// @param {ID} childInitializingNodeID
  64. ///
  65. /// @returns {}
  66. this.initializingNodeFromPrototype = [ /* nodeID, childID, childInitializingNodeID */ ]
  67. /// Description.
  68. ///
  69. /// @function
  70. ///
  71. /// @param {ID} nodeID
  72. ///
  73. /// @returns {}
  74. this.deletingNode = [ /* nodeID */ ]
  75. /// Description.
  76. ///
  77. /// @function
  78. ///
  79. /// @param {}
  80. ///
  81. /// @returns {}
  82. this.addingChild = []
  83. /// Description.
  84. ///
  85. /// @function
  86. ///
  87. /// @param {}
  88. ///
  89. /// @returns {}
  90. this.removingChild = []
  91. /// Description.
  92. ///
  93. /// @function
  94. ///
  95. /// @param {}
  96. ///
  97. /// @returns {}
  98. this.settingProperties = []
  99. /// Description.
  100. ///
  101. /// @function
  102. ///
  103. /// @param {}
  104. ///
  105. /// @returns {}
  106. this.gettingProperties = []
  107. /// Description.
  108. ///
  109. /// @function
  110. ///
  111. /// @param {}
  112. ///
  113. /// @returns {}
  114. this.creatingProperty = []
  115. /// Description.
  116. ///
  117. /// @function
  118. ///
  119. /// @param {}
  120. ///
  121. /// @returns {}
  122. this.initializingProperty = []
  123. // TODO: deletingProperty
  124. /// Description.
  125. ///
  126. /// @function
  127. ///
  128. /// @param {ID} nodeID
  129. /// @param {String} propertyName
  130. /// @param {Object} propertyValue
  131. ///
  132. /// @returns {Object}
  133. /// A value set on property or undefined if not set.
  134. ///
  135. /// The first non-undefined return value will be sent with the "satProperty" event (which
  136. /// may differ from the incoming propertyValue).
  137. this.settingProperty = []
  138. /// Description.
  139. ///
  140. /// @function
  141. ///
  142. /// @param {}
  143. ///
  144. /// @returns {}
  145. this.gettingProperty = []
  146. /// Description.
  147. ///
  148. /// @function
  149. ///
  150. /// @param {ID} nodeID
  151. /// @param {String} methodName
  152. /// @param {String[]} methodParameters
  153. /// @param {String} methodBody
  154. ///
  155. /// @returns {Handler} methodHandler
  156. this.creatingMethod = [ /* nodeID, methodName, methodParameters, methodBody */ ]
  157. // TODO: deletingMethod
  158. /// Description.
  159. ///
  160. /// @function
  161. ///
  162. /// @param {ID} nodeID
  163. /// @param {String} methodName
  164. /// @param {Handler} methodHandler
  165. ///
  166. /// @returns {Handler} methodHandler
  167. this.settingMethod = [ /* nodeID, methodName, methodHandler */ ]
  168. /// Description.
  169. ///
  170. /// @function
  171. ///
  172. /// @param {ID} nodeID
  173. /// @param {String} methodName
  174. ///
  175. /// @returns {Handler} methodHandler
  176. this.gettingMethod = [ /* nodeID, methodName */ ]
  177. /// Description.
  178. ///
  179. /// @function
  180. ///
  181. /// @param {ID} nodeID
  182. /// @param {String} methodName
  183. /// @param {String[]} methodParameters
  184. ///
  185. /// @returns {}
  186. this.callingMethod = [ /* nodeID, methodName, methodParameters */ ]
  187. /// Description.
  188. ///
  189. /// @function
  190. ///
  191. /// @param {ID} nodeID
  192. /// @param {String} eventName
  193. /// @param {ListenerID} eventListenerID
  194. /// @param {Handler} eventHandler
  195. /// @param {ID} eventContextID
  196. /// @param {String[]} eventPhases
  197. ///
  198. /// @returns {Boolean}
  199. this.addingEventListener = [ /* nodeID, eventName, eventListenerID, eventHandler, eventContextID, eventPhases */ ]
  200. /// Description.
  201. ///
  202. /// @function
  203. ///
  204. /// @param {ID} nodeID
  205. /// @param {String} eventName
  206. /// @param {ListenerID} eventListenerID
  207. ///
  208. /// @returns {Boolean}
  209. this.removingEventListener = [ /* nodeID, eventName, eventListenerID */ ]
  210. /// Description.
  211. ///
  212. /// @function
  213. ///
  214. /// @param {ID} nodeID
  215. /// @param {String} eventName
  216. /// @param {ListenerID} eventListenerID
  217. /// @param {Listener} eventListener
  218. ///
  219. /// @returns {Listener}
  220. this.settingEventListener = [ /* nodeID, eventName, eventListenerID, eventListener */ ]
  221. /// Description.
  222. ///
  223. /// @function
  224. ///
  225. /// @param {ID} nodeID
  226. /// @param {String} eventName
  227. /// @param {ListenerID} eventListenerID
  228. ///
  229. /// @returns {Listener}
  230. this.gettingEventListener = [ /* nodeID, eventName, eventListenerID */ ]
  231. /// Description.
  232. ///
  233. /// @function
  234. ///
  235. /// @param {ID} nodeID
  236. /// @param {String} eventName
  237. /// @param {ID} eventContextID
  238. ///
  239. /// @returns {}
  240. this.flushingEventListeners = [ /* nodeID, eventName, eventContextID */ ]
  241. /// Description.
  242. ///
  243. /// @function
  244. ///
  245. /// @param {ID} nodeID
  246. /// @param {String} eventName
  247. /// @param {String[]} eventParameters
  248. ///
  249. /// @returns {}
  250. this.creatingEvent = [ /* nodeID, eventName, eventParameters */ ]
  251. // TODO: deletingEvent
  252. /// Description.
  253. ///
  254. /// @function
  255. ///
  256. /// @param {ID} nodeID
  257. /// @param {String} eventName
  258. /// @param {String[]} eventParameters
  259. ///
  260. /// @returns {}
  261. this.firingEvent = [ /* nodeID, eventName, eventParameters */ ]
  262. /// Description.
  263. ///
  264. /// @function
  265. ///
  266. /// @param {}
  267. /// @returns {}
  268. this.executing = []
  269. /// Time has changed, probably by about the same amount as last time.
  270. ///
  271. /// Don't rely on `ticking` notifications; but if you do, don't rely on them to arrive at
  272. /// any particular rate. `ticking` may be removed in the future to allow the reflector to
  273. /// vary the idle message interval.
  274. ///
  275. /// To schedule actions for certain times, use the `when` parameter in the
  276. /// {@link module:vwf/kernel/model Kernel API}.
  277. ///
  278. /// @function
  279. ///
  280. /// @param {Number} time
  281. ///
  282. /// @returns {}
  283. ///
  284. /// @deprecated in version 0.6.23. Use the {@link module:vwf/kernel/model Kernel API} `when`
  285. /// parameter to schedule future actions.
  286. this.ticking = []
  287. /// Description.
  288. ///
  289. /// @callback module:vwf/api/model~readyCallback
  290. ///
  291. /// @param {Boolean} ready
  292. }
  293. }
  294. export {
  295. ModelApi
  296. }