Built-in Editor Functions
ESP.openEditor
Opens a new page to edit one of your JavaScript or data files.
Syntax:
ESP.openEditor(file_id)
- file_id is the identifier that you used to create the JavaScript or data file in esphome.app site. If you wish to edit the main JavaScript file, id of the file would be jsesp_{device_id}, for instance if your device id is ‘sample_device’, if to edit the main JavaScript file will be jsesp_sample_device. For all other files (JavaScript and Data files), use the id of that file.
This function does not return any value.
ESP.onEditorFileUpdated
Get notified when file edited in app and saved.
Syntax:
ESP.onEditorFileUpdated(file_id, callback)
- file_id is the identifier that you used to create the JavaScript or data file in esphome.app site.
- callback is the function that will be called when user saved the file. General form of the callback function is
function(){}
.
Example:
ESP.onEditorFileUpdated('my_json_data', function(){
doSomething();
});