mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Fixed tests and ILockerRepository and ILockerService merge
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
|
||||
angular
|
||||
.module('angular-locker-tests', ['angular-locker'])
|
||||
.config(['lockerProvider', function config(lockerProvider) {
|
||||
.config(['lockerProvider', function config(lockerProvider: angular.locker.ILockerProvider) {
|
||||
let lockerSettings: angular.locker.ILockerSettings = {
|
||||
driver: 'session',
|
||||
namespace: 'myApp',
|
||||
separator: '.',
|
||||
eventsEnabled: true,
|
||||
extend: {}
|
||||
extend: <any>{}
|
||||
};
|
||||
|
||||
lockerProvider.defaults(lockerSettings);
|
||||
@@ -38,7 +38,7 @@ angular
|
||||
locker.put('someKey', ['foo', 'bar']);
|
||||
|
||||
//The current value will be passed into the function so you can perform logic on the current value, before returning it. e.g.
|
||||
locker.put('someKey', function(current) {
|
||||
locker.put('someKey', function(current: any) {
|
||||
current.push('baz');
|
||||
|
||||
return current;
|
||||
@@ -47,7 +47,7 @@ angular
|
||||
locker.get('someKey'); // = ['foo', 'bar', 'baz']
|
||||
|
||||
// given locker.get('foo') is not defined
|
||||
locker.put('foo', function (current) {
|
||||
locker.put('foo', function (current: any) {
|
||||
// current will equal 'bar'
|
||||
}, 'bar');
|
||||
|
||||
|
||||
15
angular-locker/angular-locker.d.ts
vendored
15
angular-locker/angular-locker.d.ts
vendored
@@ -15,7 +15,7 @@ declare module angular.locker {
|
||||
(current: any): any
|
||||
}
|
||||
|
||||
interface ILockerRepository {
|
||||
interface ILockerService {
|
||||
/**
|
||||
* Add an item to storage if it doesn't already exist
|
||||
*
|
||||
@@ -85,14 +85,14 @@ declare module angular.locker {
|
||||
*
|
||||
* @param {String} key The key to remove
|
||||
*/
|
||||
forget(key: string): void;
|
||||
forget(key: string): ILockerService;
|
||||
/**
|
||||
* Remove specified item(s) from storage
|
||||
*
|
||||
* @param {Array} keys The array of keys to remove
|
||||
*
|
||||
*/
|
||||
forget(keys: Array<string>): void;
|
||||
forget(keys: Array<string>): ILockerService;
|
||||
/**
|
||||
* Retrieve the specified item from storage and then remove it
|
||||
*
|
||||
@@ -100,9 +100,6 @@ declare module angular.locker {
|
||||
* @param {Mixed} def The default value if it does not exist
|
||||
*/
|
||||
pull(key: string | Array<string>, defaultValue?: any): any;
|
||||
}
|
||||
|
||||
interface ILockerService extends ILockerRepository {
|
||||
/**
|
||||
* Bind a storage key to a $scope property
|
||||
*
|
||||
@@ -136,7 +133,7 @@ declare module angular.locker {
|
||||
*
|
||||
* @param {String} namespace The namespace to switch to
|
||||
*/
|
||||
'namespace'(name: string): ILockerRepository;
|
||||
'namespace'(name: string): ILockerService;
|
||||
/**
|
||||
* Check browser support
|
||||
*
|
||||
@@ -151,7 +148,7 @@ declare module angular.locker {
|
||||
* @param {Object} $scope The angular $scope object
|
||||
* @param {String} key The key to remove from bindings
|
||||
*/
|
||||
unbind(scope: IScope, property: string): void;
|
||||
unbind(scope: IScope, property: string): ILockerService;
|
||||
}
|
||||
|
||||
interface ILockerSettings {
|
||||
@@ -159,7 +156,7 @@ declare module angular.locker {
|
||||
'namespace'?: string | boolean;
|
||||
separator?: string;
|
||||
eventsEnabled?: boolean;
|
||||
extend?: any;
|
||||
extend?: Object;
|
||||
}
|
||||
|
||||
interface ILockerProvider extends angular.IServiceProvider {
|
||||
|
||||
Reference in New Issue
Block a user