Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ function now(){
return (new Date).getTime();
}

function Quickling(selector, container){
function Quickling(selector, container,option){
var self = this;

self.option=option?option:{};
self.selector = selector;
self.container = $(container)[0];
self.expires = 0;
Expand Down Expand Up @@ -122,6 +123,9 @@ Quickling.prototype = {
self.isForce = false;
self.loader = Pagelet.load(url, function(data, status){
self.loader = null;
if(self.option.beforeRender&&self.option.beforeRender(data,status)==false){
return;
}
Pagelet.append(self.container, data);
self.caches[url] = {data: data, time: now()};
self.trigger('send:back', [data, status]);
Expand Down Expand Up @@ -164,12 +168,13 @@ Quickling.prototype = {

var instance;

return function(className, container){
return function(className, container,option){
if(instance){
return instance;
}

return instance = new Quickling(className, container);
return instance = new Quickling(className, container,option);
};

});