I also tried using browser sync for a one-page base application.
Route changes are mostly triggered by clicking on the anchors. Unfortunately, browser synchronization does not work very well with events that have stopPropagation, and therefore the click did not start in other browsers, and the routes were synchronized.
Since then, I have branched and fixed this plus other issues, namely event synchronization for mouseup, mousedown, keyup, keydown, and contenteditable div.
pull-request , - https://github.com/nitinsurana/browser-sync-client
, , . , -
, , .
var bs = require("browser-sync").create();
var client = require("./");
client["plugin:name"] = "client:script";
bs.use(client);
bs.init({
proxy: 'http://localhost:8080',
open: false,
minify: false,
snippetOptions: {
rule: {
match: /<\/head>/i,
fn: function (snippet) {
return snippet + "\n</head>";
}
}
},
clientEvents: [
"scroll",
"input:text",
"input:toggles",
"input:keydown",
"input:keypress",
"form:submit",
"form:reset",
"click",
"contenteditable:input",
"mouseup",
"mousedown",
"select:change"
],
ghostMode: {
clicks: true,
scroll: true,
forms: {
submit: true,
inputs: true,
toggles: true,
keypress: true,
keydown: true,
contenteditable: true,
change: true
},
mouseup: true,
mousedown: true
},
capture:true
});