Last active
November 20, 2015 17:43
-
-
Save typeoneerror/2f00ec956769747bcf31 to your computer and use it in GitHub Desktop.
sidebar toggler with ember
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
| export function initialize(container, application) { | |
| console.log('LocalStorageService::initialize'); | |
| application.inject('route', 'localStorage', 'service:local-storage'); | |
| application.inject('controller', 'localStorage', 'service:local-storage'); | |
| application.inject('component', 'localStorage', 'service:local-storage'); | |
| application.inject('view', 'localStorage', 'service:local-storage'); | |
| } | |
| export default { | |
| name: 'local-storage-service', | |
| initialize: initialize, | |
| after: 'const' | |
| }; |
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
| import Ember from 'ember'; | |
| export default Ember.Object.extend({ | |
| isAvailable: function() { | |
| return Modernizr.localstorage; | |
| }, | |
| get: function(property) { | |
| return localStorage.getItem(property); | |
| }, | |
| set: function(property, value) { | |
| localStorage.setItem(property, value); | |
| }, | |
| delete: function(property) { | |
| localStorage.removeItem(property); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment