Skip to content

Instantly share code, notes, and snippets.

@DrMabuse23
Created September 26, 2014 13:58
Show Gist options
  • Save DrMabuse23/fc9b45ffebc5fd2939bc to your computer and use it in GitHub Desktop.
Save DrMabuse23/fc9b45ffebc5fd2939bc to your computer and use it in GitHub Desktop.
/**
* Created by pascal on 26.09.14.
* @name StorageList
*/
'use strict';
requirejs(['can/util/library', 'can/control','can/model','can/route'], function(can){
var APIURL = 'test';
/**
* the penglr api
*/
var API = can.Model({
findOne:'Get '+APIURL+'/recent',
findAll:'Get '+APIURL+'/pages/{nextPageID}'
}, {});
var Routing = can.Control({
'route': function() {
// Matches every routing change, but gets passed no data.
},
'history route': function(data) {
// Matches routes like #!todos/5,
// and will get passed {id: 5} as data.
console.log('history',data);
},
':type/:id route': function(data) {
// Matches routes like #!recipes/5,
// and will get passed {id: 5, type: 'recipes'} as data.
}
});
new Routing(window);
can.route.ready();
var History = can.Control({
init: function(el, options) {
var self = this;
var api = new API();
API.findOne({},function(recent){
console.log('recent',recent);
});
}
});
new Routing(window);
can.route.ready();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment