@tenjuu99/blog 0.2.45 → 0.2.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -124,22 +124,29 @@ const turbolinks = () => {
|
|
|
124
124
|
if (`${url.pathname}${url.search}` === `${current.pathname}${current.search}`) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
window.turbolink_before_transition[k].apply()
|
|
129
|
-
}
|
|
130
|
-
await transition(href)
|
|
131
|
-
for (let k in window.turbolink_after_transition) {
|
|
132
|
-
window.turbolink_after_transition[k].apply()
|
|
133
|
-
}
|
|
134
|
-
history.pushState({}, '', href)
|
|
135
|
-
turbolinks()
|
|
127
|
+
await executeTransition(href)
|
|
136
128
|
}
|
|
137
129
|
}
|
|
138
130
|
})
|
|
139
131
|
}
|
|
132
|
+
|
|
133
|
+
const executeTransition = async (href) => {
|
|
134
|
+
for (let k in window.turbolink_before_transition) {
|
|
135
|
+
window.turbolink_before_transition[k].apply()
|
|
136
|
+
}
|
|
137
|
+
await transition(href)
|
|
138
|
+
for (let k in window.turbolink_after_transition) {
|
|
139
|
+
window.turbolink_after_transition[k].apply()
|
|
140
|
+
}
|
|
141
|
+
history.pushState({}, '', href)
|
|
142
|
+
turbolinks()
|
|
143
|
+
}
|
|
144
|
+
|
|
140
145
|
document.body.onload = turbolinks
|
|
141
146
|
window.onpopstate = async (e) => {
|
|
142
147
|
const href = window.location.pathname + window.location.search + window.location.hash
|
|
143
148
|
await transition(href)
|
|
144
149
|
turbolinks()
|
|
145
150
|
}
|
|
151
|
+
|
|
152
|
+
window.executeTransition = executeTransition
|