Skip to content

Instantly share code, notes, and snippets.

View fdrobidoux's full-sized avatar
📚
Working on a ReactJS certification!

Félix Dion-Robidoux fdrobidoux

📚
Working on a ReactJS certification!
View GitHub Profile
@fdrobidoux
fdrobidoux / pubsub.js
Last active August 29, 2019 18:15 — forked from jyotiarora2610/Pub sub pattern
Simple publish/subscribe pattern in javascript.
let subscribers = {};
module.exports = {
publish(event, data) {
if (!subscribers[event]) return;
subscribers.forEach(callback => {
callback(data);
})
},
<?php
/*
* Add this code to your theme's functions.php file
*/
// Theme activation
add_action("after_switch_theme", "theme_activated");
function theme_activation_hook(){
error_log('theme activated');
}