Author: jmorliaguet Date: Sat Feb 4 21:42:59 2006 New Revision: 2293 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log:
- added a periodical refresh option to update the model on a regular time interval (cf http://ajaxpatterns.org/Periodic_Refresh) this is used mainly with remote storages, e.g. online chat Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 4 21:42:59 2006 @@ -678,12 +678,19 @@ } var model = this; var storage = Storages[storage_def.type](this); + // the model reacts to events on the storage and notifies observers CPSSkins.registerEventHandler('stored', model, function(event) { CPSSkins.notify('modified', model); }); CPSSkins.subscribe('stored', {'subscriber': model, 'target': storage}); + + var refresh = storage_def.refresh; + if (refresh && refresh > 0) { + new PeriodicalExecuter(function() {storage.requestData()}, refresh); + } + return storage; } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins