mirror of
https://github.com/wassname/template.git
synced 2026-07-11 05:16:20 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a54f434a52 | |||
| 2ab9a24a79 |
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "distill-template",
|
"name": "distill-template",
|
||||||
"version": "2.2.8",
|
"version": "2.2.9",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "distill-template",
|
"name": "distill-template",
|
||||||
"version": "2.2.8",
|
"version": "2.2.9",
|
||||||
"description": "Template for creating Distill articles.",
|
"description": "Template for creating Distill articles.",
|
||||||
"main": "dist/template.v2.js",
|
"main": "dist/template.v2.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ const distillMain = function() {
|
|||||||
console.info('Runlevel 3: We can now listen to controller events.');
|
console.info('Runlevel 3: We can now listen to controller events.');
|
||||||
console.info('Runlevel 3->4.');
|
console.info('Runlevel 3->4.');
|
||||||
window.distillRunlevel += 1;
|
window.distillRunlevel += 1;
|
||||||
|
// If template was added after DOMContentLoaded we may have missed that event.
|
||||||
|
// Controller will check for that case, so trigger the event explicitly:
|
||||||
|
Controller.listeners.DOMContentLoaded();
|
||||||
|
|
||||||
console.info('Runlevel 4: Distill Template initialisation complete.');
|
console.info('Runlevel 4: Distill Template initialisation complete.');
|
||||||
};
|
};
|
||||||
|
|||||||
+5
-1
@@ -145,7 +145,11 @@ export const Controller = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
DOMContentLoaded() {
|
DOMContentLoaded() {
|
||||||
if (Controller.loaded || !domContentLoaded()) {
|
if (Controller.loaded) {
|
||||||
|
console.warn('Controller received DOMContentLoaded but was already loaded!');
|
||||||
|
return;
|
||||||
|
} else if (!domContentLoaded()) {
|
||||||
|
console.warn('Controller received DOMContentLoaded before appropriate document.readyState!');
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Controller.loaded = true;
|
Controller.loaded = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user