Open
Conversation
Went looking for references to API function that assume the API is available on the global scope or that `$` is accessible, and conformed all found to use `this.$`, the link to `$` that's added to every function member of `$`
when running a script in the sandbox, __file__ is undefined, so trying to look at $ in the debugger errors out when it tries to generate the oH directory. If we use the __file__ it stored when it was required in, we can avoid this error. $.directory is supposed to refer to the oH dir, so I can't think of why this would be a problem
For some reason, `this.$` is undefined for this line, however `this.prototype.$` is. With the debug console I tried to set `this.$ = this.prototype.$`, and it didn't work, it stayed undefined. Then I tried using an intermediary constant, which did work. Referencing `exports` bypasses the issue. Is this a different case because we're not instantiating an oPreferences object, so the prototype isn't linked in the same way?
it does seem to add $ to the global __proto__, but I thought it was supposed to make eg `log` or `oNode` accessible globally, and it doesn't seem to
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restructured slightly so that openHarmony is used by calling
const $ = require("openHarmony.js")instead ofinclude. Each sub-script adds its functions to theexportsobject, which the main scriptrequire()s, and then adds the attributes of to$.It seems like using
includemay still work, although I haven't tested this thouroughly yet.In the current state, it can run the example script and make a car, although there are several errors with cloning nodes (
TypeError: ambiguous call of overloaded function setValue(), in ...attribute.js ln695), and with linking nodes that don't seem to impact the car.TO DO:
this.__proto__[classItem] = $[classItem]which I thought would add them to the prototype of the global scope, like the regular API functions, but they ended up as members of the top-levelthis, so I obviously don't understand what's going on../openHarmony/*,./openHarmony.js, and./examples/openHarmonyExample.jsinlcude. I have a funny setup locally, so I haven't gotten around to looking at these yet