Skip to main content Skip to navigation

Step 4: Edit video description in-page

Spinner

Important code

var listener = new EventListener();
listener.onPropertiesChange = function(event){
if(event.getPage().path == data.path) {
if(event.result == 0) {
target.innerHTML = trimText(data.description, 20);
target.style.backgroundColor = '#fff';
} else {
window.alert('Error saving data');
target.innerHTML = trimText(data.originalData.description, 20);
target.style.backgroundColor = '#fff';
}
}
};
ChangeEventConsumer.addEventConsumer(listener);

When the properties or permissions are saved the operation fires an onPropertiesChange or onPermissionsChange respectively. The above code sets up the listener to listen for the properties change and add the listener to the event consumer.

data.setDescription($F(target.getElementsByTagName('TEXTAREA')[0]));

data.saveProperties();

The above two lines show how easy it is to update a page's metadata using the API.