‘use client’; import { usePathname } from ‘next/navigation’; import { useEffect, useState } from ‘react’; export function RouteChangeListener() { const pathname = usePathname(); const [changes, setChanges] = useState(0); useEffect(() => { if (window.om5678_1234) { window.om5678_1234.reset(); } setChanges((prev) => prev +…Continue reading
import { useEffect } from ‘react’; import { useRouter } from ‘next/router’; const OptinMonsterEmbed = () => { const router = useRouter() useEffect(() => { const handleRouteChange = (url, { shallow }) => { if (window.om5678_1234) { window.om5678_1234.reset(); } }…Continue reading
// Using AngularJS. var myApp = angular.module(‘myApp’, []); myApp.run(function($rootScope) { $rootScope.$on(“$locationChangeStart”, function(event, next, current) { if (window.om5678_1234) { window.om5678_1234.reset(); } }); });Continue reading
// Using React Router V3 import { browserHistory } from ‘react-router’; class App extends React.component { componentDidMount() { this.unlisten = browserHistory.listen( location => { if (window.om5678_1234) { window.om5678_1234.reset(); } }); } componentWillUnmount() { this.unlisten(); } render() { return ( ‘…Continue reading
// Using React Router V4 import React from “react”; import { withRouter } from “react-router”; class App extends Component { componentDidMount() { this.unlisten = this.props.history.listen((location, action) => { if (window.om5678_1234) { window.om5678_1234.reset(); } }); } componentWillUnmount() { this.unlisten(); } render()…Continue reading
// Using Vue Router. import Vue from ‘vue’; import Router from ‘vue-router’; Vue.use(Router); const router = new Router ({ // Your vue router settings. }); router.beforeEach((to, from, next) => { if (window.om5678_1234) { window.om5678_1234.reset(); } next(); }); export default router;Continue reading