1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 06:43:15 +00:00

Add new th-page-refreshed hook

This commit is contained in:
Jermolene 2018-01-04 16:01:19 +00:00
parent 3f5e8aed3d
commit de4eb5ca89
2 changed files with 17 additions and 0 deletions

View File

@ -57,6 +57,7 @@ exports.startup = function() {
$tw.utils.addClass($tw.pageContainer,"tc-page-container-wrapper"); $tw.utils.addClass($tw.pageContainer,"tc-page-container-wrapper");
document.body.insertBefore($tw.pageContainer,document.body.firstChild); document.body.insertBefore($tw.pageContainer,document.body.firstChild);
$tw.pageWidgetNode.render($tw.pageContainer,null); $tw.pageWidgetNode.render($tw.pageContainer,null);
$tw.hooks.invokeHook("th-page-refreshed");
})(); })();
// Prepare refresh mechanism // Prepare refresh mechanism
var deferredChanges = Object.create(null), var deferredChanges = Object.create(null),
@ -65,6 +66,7 @@ exports.startup = function() {
// Process the refresh // Process the refresh
$tw.pageWidgetNode.refresh(deferredChanges); $tw.pageWidgetNode.refresh(deferredChanges);
deferredChanges = Object.create(null); deferredChanges = Object.create(null);
$tw.hooks.invokeHook("th-page-refreshed");
} }
// Add the change event handler // Add the change event handler
$tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) { $tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) {

View File

@ -0,0 +1,15 @@
created: 20180104155916980
modified: 20180104160025999
tags: HookMechanism
title: Hook: th-page-refreshed
type: text/vnd.tiddlywiki
This hook notifies plugins that a page refresh has just occurred. It is typically used to apply post-rendering effects.
Hook function parameters:
* (none)
Return value:
* (none)