"use strict"; /** * @type {{emit: emit, on: on}} */ var BS = window.___browserSync___ || {}; exports.socket = BS.socket || { emit: function(){}, on: function(){} }; /** * @returns {string} */ exports.getPath = function () { return window.location.pathname; }; /** * Alias for socket.emit * @param name * @param data */ exports.emit = function (name, data) { var socket = exports.socket; if (socket && socket.emit) { // send relative path of where the event is sent data.url = exports.getPath(); socket.emit(name, data); } }; /** * Alias for socket.on * @param name * @param func */ exports.on = function (name, func) { exports.socket.on(name, func); };