Last active
December 13, 2015 18:19
-
-
Save noomz/4954573 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SimpleBroadcast = (function () { | |
var sub = {}; | |
return { | |
publish: function (topic, data) { | |
data = data || {}; | |
(sub[topic] || []).forEach(function (func) { | |
func(data); | |
}); | |
}, | |
subscribe: function (topic, func) { | |
sub[topic] = sub[topic] || []; | |
sub[topic].push(func); | |
} | |
}; | |
})(); |
update แล้วคร้าบบ เอา jquery ออกด้วย
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
h นั่นเปลี่ยนชื่อเป็น topic ดีกว่า