Code Monkey home page Code Monkey logo

Comments (10)

nen777w avatar nen777w commented on July 22, 2024 1

@DeeJayMX , @s00500 Done: #81

from espui.

nen777w avatar nen777w commented on July 22, 2024

Update: I implemented it as...

//h
#define UI_RELOAD ControlType::Reload
//cpp
bool ESPUIClass::remControl(uint16_t id, bool reload_ui)
{
  if(nullptr == this->controls) return false;

  Control * it = this->controls;
  
  if(id == it->id) {
    this->controls = it->next;
    delete it;
    if(reload_ui) {
      reload();
    }
    return true;
  }

  Control * it_next = it->next;
  while(nullptr != it_next && id != it_next->id) {
    it = it_next;
    it_next = it_next->next;
  }

  if(nullptr != it_next) {
    it->next = it_next->next;
    delete it_next;
    if(reload_ui) {
      reload();
    }    
    return true;
  }
  
  return false;
}

void ESPUIClass::reload()
{
  int tryId = 0;

  for (int count = 0; count < this->ws->count();) {
    if (this->ws->hasClient(tryId)) {
      ESPUI.jsonReload(this->ws->client(tryId));
      count++;
    }
    tryId++;
  }
}

void ESPUIClass::jsonReload(AsyncWebSocketClient *client)
{
  String json;
  DynamicJsonDocument document(jsonUpdateDocumentSize);
  JsonObject root = document.to<JsonObject>();

  root["type"] = (int)UI_RELOAD;
  serializeJson(document, json);

  if (this->verbosity >= Verbosity::VerboseJSON) {
    Serial.println(json);
  }

  this->ws->textAll(json);
}

on js side:

 var handleEvent = function(evt) {
.....
 case UI_RELOAD:
	window.location.reload();
	break;

from espui.

s00500 avatar s00500 commented on July 22, 2024

You could make a pull request and we could look into merging it

from espui.

nen777w avatar nen777w commented on July 22, 2024

ok

from espui.

DeeJayMX avatar DeeJayMX commented on July 22, 2024

Does this implementation is done ?

from espui.

nen777w avatar nen777w commented on July 22, 2024

Does this implementation is done ?

Sorry. I completely forgot about that. I will make the Pool Request today.

from espui.

nen777w avatar nen777w commented on July 22, 2024

You could make a pull request and we could look into merging it

I can't make pull request:
`
$ git push --set-upstream origin rem_control
ERROR: Permission to s00500/ESPUI.git denied to nen777w.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
`
Please make sure you have the correct access rights
and the repository exists.

Should I use a specific branch for it?

from espui.

DeeJayMX avatar DeeJayMX commented on July 22, 2024

Do you have another repo for that ?

from espui.

s00500 avatar s00500 commented on July 22, 2024

@nen777w please fork the repository first using the fork button, then push a branch on your own fork of the repo and then make a pull request to this repository again, this is how it works on github ;-)

from espui.

nen777w avatar nen777w commented on July 22, 2024

@nen777w please fork the repository first using the fork button, then push a branch on your own fork of the repo and then make a pull request to this repository again, this is how it works on github ;-)

OMG... OK :-)
I Will do it today or tomorrow.

from espui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.