mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-04-04 20:54:36 +00:00
add angularLocalStorage type files
This commit is contained in:
27
angularLocalStorage/angularLocalStorage-tests.ts
Normal file
27
angularLocalStorage/angularLocalStorage-tests.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
///<reference path="../angularjs/angular.d.ts" />
|
||||
///<reference path="./angularLocalStorage.d.ts" />
|
||||
|
||||
interface TestScope extends ng.IScope {
|
||||
viewType: string;
|
||||
}
|
||||
|
||||
module angularLocalStorageTests {
|
||||
export class TestController {
|
||||
constructor(private $scope: TestScope, private storage: AngularLocalStorageService) {
|
||||
storage.bind($scope, 'varName');
|
||||
storage.bind($scope,'varName', { defaultValue: 'randomValue123', storeName: 'customStoreKey' });
|
||||
$scope.viewType = 'ANYTHING';
|
||||
storage.unbind($scope, 'viewType');
|
||||
|
||||
storage.set('key', 'value');
|
||||
storage.get('key');
|
||||
storage.remove('key');
|
||||
|
||||
storage.clearAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var app = angular.module('angularLocalStorageTests', ['angularLocalStorage']);
|
||||
app.controller('testCtrl', ['$scope', 'storage', ($scope: TestScope, storage: AngularLocalStorageService) => new angularLocalStorageTests.TestController($scope, storage)]);
|
||||
|
||||
20
angularLocalStorage/angularLocalStorage.d.ts
vendored
Normal file
20
angularLocalStorage/angularLocalStorage.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Type definitions for AngularLocalStorage 0.1.7
|
||||
// Project: https://github.com/agrublev/angularLocalStorage
|
||||
// Definitions by: Horiuchi_H <https://github.com/horiuchi/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts"/>
|
||||
|
||||
interface AngularLocalStorageService {
|
||||
set(key: string, value: any): any;
|
||||
get(key: string): any;
|
||||
remove(key: string): boolean;
|
||||
clearAll(): void;
|
||||
|
||||
bind($scope: ng.IScope, key: string, opts?: {
|
||||
defaultValue?: any;
|
||||
storeName?: string;
|
||||
}): any;
|
||||
unbind($scope: ng.IScope, key: string, storeName?: string): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user