Skip to content

Instantly share code, notes, and snippets.

@dmtw
Forked from joladev/nsfw.js
Last active August 29, 2015 14:16
Show Gist options
  • Save dmtw/19aa5f144df80ad14866 to your computer and use it in GitHub Desktop.
Save dmtw/19aa5f144df80ad14866 to your computer and use it in GitHub Desktop.
angular.module('app.services')
.factory('Nsfw', function ($rootScope) {
'use strict';
var _nsfw = false;
var broadcastNsfw = function (nsfw) {
$rootScope.$broadcast('Nsfw.Update', nsfw);
};
var toggleNsfw = function () {
_nsfw = !_nsfw;
broadcastNsfw(_nsfw);
};
return {
toggleNsfw: toggleNsfw,
nsfw: _nsfw
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment