Browse Source

Javascript class refactor

master
Odilitime 2 years ago
parent
commit
08cd03b05c
1 changed files with 4 additions and 7 deletions
  1. 4
    7
      src/interfaces/components/DocumentComponent.cpp

+ 4
- 7
src/interfaces/components/DocumentComponent.cpp View File

@@ -83,11 +83,8 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
std::cout << "DocumentComponent::DocumentComponent - ERROR: Could not load res/ntr_bootstrap.js" << std::endl;
} else {
//std::cout << "DocumentComponent::DocumentComponent - Loaded [" << bootstrap_js << "] ntr_bootstrap.js\n";
JSParser jsparser;
this->bootstrapScript = std::make_shared<JavaScript>();
this->bootstrapScript->tokens = jsparser.getTokens(bootstrap_js);
jsparser.parseTokens(this->bootstrapScript->tokens, &this->bootstrapScript->rootScope);
//this->bootstrapScript = jsparser.parse(bootstrap_js);
this->bootstrapScript->parse(bootstrap_js);
}

//std::cout << "DocumentComponent::DocumentComponent - our size" << static_cast<int>(width) << "x" << static_cast<int>(height) << std::endl;
@@ -292,7 +289,7 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
if (key == GLFW_KEY_V && action == GLFW_RELEASE) {
printf("Printing JS Variables\n\n");
//std::cout << "DocumentComponent::render - JS var state" << std::endl;
for(auto it : this->mainScript->rootScope.variables) {
for(auto it : this->mainScript->rootScope.locals.value) {
std::cout << "[" << it.first << "=" << it.second << "]" << std::endl;
}
printf("\n\n");
@@ -423,8 +420,8 @@ void DocumentComponent::setDOM(const std::shared_ptr<Node> rootNode) {
mainScript = std::make_shared<JavaScript>();

if (this->bootstrapScript) {
JSParser jsparser;
jsparser.append(mainScript, this->bootstrapScript);
mainScript->applyScope(this->bootstrapScript);
mainScript->append(this->bootstrapScript);
} else {
std::cout << "DocumentComponent::setDOM - no bootstrap JS loaded\n";
}

Loading…
Cancel
Save