From 35fcdd270e2745eabd50e96082f53b80ef7d45b5 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Wed, 13 Aug 2014 20:25:23 +0100 Subject: [PATCH] Move syncer event handlers into syncer module --- core/modules/startup/rootwidget.js | 21 --------------------- core/modules/syncer.js | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/modules/startup/rootwidget.js b/core/modules/startup/rootwidget.js index 8bce552b5..f28d5b776 100644 --- a/core/modules/startup/rootwidget.js +++ b/core/modules/startup/rootwidget.js @@ -35,27 +35,6 @@ exports.startup = function() { $tw.rootWidget.addEventListener("tw-scroll",function(event) { $tw.pageScroller.handleEvent(event); }); - // Install the save action handlers - $tw.rootWidget.addEventListener("tw-save-wiki",function(event) { - $tw.syncer.saveWiki({ - template: event.param, - downloadType: "text/plain" - }); - }); - $tw.rootWidget.addEventListener("tw-auto-save-wiki",function(event) { - $tw.syncer.saveWiki({ - method: "autosave", - template: event.param, - downloadType: "text/plain" - }); - }); - $tw.rootWidget.addEventListener("tw-download-file",function(event) { - $tw.syncer.saveWiki({ - method: "download", - template: event.param, - downloadType: "text/plain" - }); - }); var fullscreen = $tw.utils.getFullScreenApis(); if(fullscreen) { $tw.rootWidget.addEventListener("tw-full-screen",function(event) { diff --git a/core/modules/syncer.js b/core/modules/syncer.js index 542bd0fc1..4d9fa6c5b 100644 --- a/core/modules/syncer.js +++ b/core/modules/syncer.js @@ -66,6 +66,27 @@ function Syncer(options) { $tw.rootWidget.addEventListener("tw-server-refresh",function() { $tw.syncer.handleRefreshEvent(); }); + // Install the save action handlers + $tw.rootWidget.addEventListener("tw-save-wiki",function(event) { + $tw.syncer.saveWiki({ + template: event.param, + downloadType: "text/plain" + }); + }); + $tw.rootWidget.addEventListener("tw-auto-save-wiki",function(event) { + $tw.syncer.saveWiki({ + method: "autosave", + template: event.param, + downloadType: "text/plain" + }); + }); + $tw.rootWidget.addEventListener("tw-download-file",function(event) { + $tw.syncer.saveWiki({ + method: "download", + template: event.param, + downloadType: "text/plain" + }); + }); } // Listen out for lazyLoad events if(this.syncadaptor) {