<commit_before>var appState = Alloy.Models.appState;
var heroes = Alloy.Collections.heroes;

function generateRandomColor() {
	var c =(Math.floor(Math.random()*255))*256*256 + 
	       (Math.floor(Math.random()*255))*256 + 
	       (Math.floor(Math.random()*255));
	c = c.toString(16);
	while (c.length < 6) {
		c = '0' + c;
	}
	return '#' + c;
}

// Contrived update function to modify the model 
// associated with the clicked row
function modifyHero(e) {
	var model = heroes.at(e.index);	
	model.set('name', model.get('name') + '+');

	// this should throw a warning since it is attempting
	// to sync on a collection that has no persistence.
	model.save();
}

// Update the model's counter and color, which in turn
// updates the UI via model binding
function updateState() {
	appState.set({
		counter: appState.get('counter')+1,
		color: generateRandomColor()
	});
}

// Simulate a change in our model to trigger UI binding.
// Remember, don't use fetch() when using a model with
// no persistence, it will generate an error.
appState.trigger('change');
heroes.trigger('change');

$.index.open();<commit_msg>add one more persistence call to throw a warning, update code comments<commit_after>var appState = Alloy.Models.appState;
var heroes = Alloy.Collections.heroes;

function generateRandomColor() {
	var c =(Math.floor(Math.random()*255))*256*256 + 
	       (Math.floor(Math.random()*255))*256 + 
	       (Math.floor(Math.random()*255));
	c = c.toString(16);
	while (c.length < 6) {
		c = '0' + c;
	}
	return '#' + c;
}

// Contrived update function to modify the model 
// associated with the clicked row
function modifyHero(e) {
	var model = heroes.at(e.index);	
	model.set('name', model.get('name') + '+');

	// this should throw a warning since it is attempting
	// to sync on a collection that has no persistence.
	model.save();
}

// Update the model's counter and color, which in turn
// updates the UI via model binding
function updateState() {
	appState.set({
		counter: appState.get('counter')+1,
		color: generateRandomColor()
	});
}

// Simulate a change in our model to trigger UI binding.
appState.trigger('change');
heroes.trigger('change');

// this should throw a warning since it is attempting
// to sync on a model that has no persistence.
appState.fetch();

$.index.open();
{'fraction_non_alphanumeric': 0.14509122502172025, 'fraction_numerical': 0.01998262380538662, 'mean_word_length': 3.8280922431865827, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1782343', 'n_tokens_mistral': 780, 'n_tokens_neox': 721, 'n_words': 237}