This is valid for HTML5 lightswitch -
There is Javascript namespace "msls" which encapsulates the LightSwitch JS framework to obtain the equivalent of EntityState.
The intellisense does not work so well, so if you keep getting screen.(nothing), add the following:
/// <reference path="../GeneratedArtifacts/viewModel.js" />
On the main event, add:
myapp.Customer.created = function (screen) {
if (screen.Customer.details.entityState == msls.EntityState.added) {
screen.details.displayName = "Add Customer";
} else {
screen.details.displayName = "Edit Customer";
}
}
where Customer is the dataset for the AddEdit HTML5 Lightscreen page.