I am using JaydData with Backbone JS. On the start page of application I am using the JayData context as:
$data.Entity.extend('$todo.Types.ToDoEntry', {
Id: { type: 'int', key: true, computed: true },
Value: { type: 'string' },
CreatedAt: { type: 'datetime' },
ModifiedAt: { type: 'datetime' },
Done: { type: 'bool' }
});
$data.EntityContext.extend('$todo.Types.ToDoContext', {
TodoEntries: { type: $data.EntitySet, elementType: $todo.Types.ToDoEntry }
});
$todo.context = new $todo.Types.ToDoContext({ name: provider, databaseName: 'todo' });
$todo.context.onReady({
success: updateView,
error: function () {
$todo.context = null;
updateView();
}
On this page $todo.context
is available for executing database operations.
But when I navigate to some other page of application, $todo.context
is not available.
How can I get the $todo.context
on all pages of the Backbone application?
Thanks.