phosphor-signaling
Advanced tools
Comparing version 0.9.5 to 0.9.6
@@ -1,197 +0,199 @@ | ||
// Generated by dts-bundle v0.3.0 | ||
declare module 'phosphor-signaling/index' { | ||
/** | ||
* An object used for type-safe inter-object communication. | ||
* | ||
* #### Notes | ||
* User code will not create a signal object directly, instead one will | ||
* be returned when accessing the property defined by the `@signal` | ||
* decorator. | ||
* | ||
* When defining a signal from plain JS (where decorators may not be | ||
* supported), the `signal` function can be invoked directly with the | ||
* class prototype and signal name. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* class SomeClass { | ||
* | ||
* @signal | ||
* valueChanged: ISignal<number>; | ||
* | ||
* } | ||
* | ||
* // ES5 alternative signal definition | ||
* signal(SomeClass.prototype, 'valueChanged'); | ||
* ``` | ||
*/ | ||
export interface ISignal<T> { | ||
/** | ||
* Connect a callback to the signal. | ||
* | ||
* @param callback - The function to invoke when the signal is | ||
* emitted. The args object emitted with the signal is passed | ||
* as the first and only argument to the function. | ||
* | ||
* @param thisArg - The object to use as the `this` context in the | ||
* callback. If provided, this must be a non-primitive object. | ||
* | ||
* @returns `true` if the connection succeeds, `false` otherwise. | ||
* | ||
* #### Notes | ||
* Connected callbacks are invoked synchronously, in the order in | ||
* which they are connected. | ||
* | ||
* Signal connections are unique. If a connection already exists for | ||
* the given `callback` and `thisArg`, this function returns `false`. | ||
* | ||
* A newly connected callback will not be invoked until the next time | ||
* the signal is emitted, even if it is connected while the signal is | ||
* being emitted. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* // connect a method | ||
* someObject.valueChanged.connect(myObject.onValueChanged, myObject); | ||
* | ||
* // connect a plain function | ||
* someObject.valueChanged.connect(myCallback); | ||
* ``` | ||
*/ | ||
connect(callback: (args: T) => void, thisArg?: any): boolean; | ||
/** | ||
* Disconnect a callback from the signal. | ||
* | ||
* @param callback - The callback connected to the signal. | ||
* | ||
* @param thisArg - The `this` context for the callback. | ||
* | ||
* @returns `true` if the connection is broken, `false` otherwise. | ||
* | ||
* #### Notes | ||
* A disconnected callback will no longer be invoked, even if it | ||
* is disconnected while the signal is being emitted. | ||
* | ||
* If no connection exists for the given `callback` and `thisArg`, | ||
* this function returns `false`. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* // disconnect a method | ||
* someObject.valueChanged.disconnect(myObject.onValueChanged, myObject); | ||
* | ||
* // disconnect a plain function | ||
* someObject.valueChanged.disconnect(myCallback); | ||
* ``` | ||
*/ | ||
disconnect(callback: (args: T) => void, thisArg?: any): boolean; | ||
/** | ||
* Emit the signal and invoke the connected callbacks. | ||
* | ||
* @param args - The args object to pass to the callbacks. | ||
* | ||
* #### Notes | ||
* If a connected callback throws an exception, dispatching of the | ||
* signal will terminate immediately and the exception will be | ||
* propagated to the call site of this function. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* someObject.valueChanged.emit(42); | ||
* ``` | ||
*/ | ||
emit(args: T): void; | ||
} | ||
/** | ||
* A decorator which defines a signal for an object. | ||
* | ||
* @param proto - The object prototype on which to define the signal. | ||
* | ||
* @param name - The name of the signal to define. | ||
* | ||
* #### Notes | ||
* When defining a signal from plain JS (where decorators may not be | ||
* supported), this function can be invoked directly with the class | ||
* prototype and signal name. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* class SomeClass { | ||
* | ||
* @signal | ||
* valueChanged: ISignal<number>; | ||
* | ||
* } | ||
* | ||
* // ES5 alternative signal definition | ||
* signal(SomeClass.prototype, 'valueChanged'); | ||
* ``` | ||
*/ | ||
export function signal(proto: any, name: string): void; | ||
/** | ||
* Get the object which is emitting the current signal. | ||
* | ||
* @returns The object emitting the current signal, or `null` if a | ||
* signal is not currently being emitted. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* someObject.valueChanged.connect(myCallback); | ||
* | ||
* someObject.valueChanged.emit(42); | ||
* | ||
* function myCallback(value: number): void { | ||
* console.log(emitter() === someObject); // true | ||
* } | ||
* ``` | ||
*/ | ||
export function emitter(): any; | ||
/** | ||
* Remove all connections where the given object is the emitter. | ||
* | ||
* @param obj - The emitter object of interest. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* disconnectEmitter(someObject); | ||
* ``` | ||
*/ | ||
export function disconnectEmitter(obj: any): void; | ||
/** | ||
* Remove all connections where the given object is the receiver. | ||
* | ||
* @param obj - The receiver object of interest. | ||
* | ||
* #### Notes | ||
* If a `thisArg` is provided when connecting a signal, that object | ||
* is considered the receiver. Otherwise, the `callback` is used as | ||
* the receiver. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* // disconnect a regular object receiver | ||
* disconnectReceiver(myObject); | ||
* | ||
* // disconnect a plain callback receiver | ||
* disconnectReceiver(myCallback); | ||
* ``` | ||
*/ | ||
export function disconnectReceiver(obj: any): void; | ||
/** | ||
* Clear all signal data associated with the given object. | ||
* | ||
* @param obj - The object for which the signal data should be cleared. | ||
* | ||
* #### Notes | ||
* This removes all signal connections where the object is used as | ||
* either the emitter or the receiver. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* clearSignalData(someObject); | ||
* ``` | ||
*/ | ||
export function clearSignalData(obj: any): void; | ||
} | ||
declare module 'phosphor-signaling' { | ||
/** | ||
* An object used for type-safe inter-object communication. | ||
* | ||
* #### Notes | ||
* User code will not create a signal object directly, instead one will | ||
* be returned when accessing the property defined by the `@signal` | ||
* decorator. | ||
* | ||
* When defining a signal from plain JS (where decorators may not be | ||
* supported), the `signal` function can be invoked directly with the | ||
* class prototype and signal name. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* class SomeClass { | ||
* | ||
* @signal | ||
* valueChanged: ISignal<number>; | ||
* | ||
* } | ||
* | ||
* // ES5 alternative signal definition | ||
* signal(SomeClass.prototype, 'valueChanged'); | ||
* ``` | ||
*/ | ||
export interface ISignal<T> { | ||
/** | ||
* Connect a callback to the signal. | ||
* | ||
* @param callback - The function to invoke when the signal is | ||
* emitted. The args object emitted with the signal is passed | ||
* as the first and only argument to the function. | ||
* | ||
* @param thisArg - The object to use as the `this` context in the | ||
* callback. If provided, this must be a non-primitive object. | ||
* | ||
* @returns `true` if the connection succeeds, `false` otherwise. | ||
* | ||
* #### Notes | ||
* Connected callbacks are invoked synchronously, in the order in | ||
* which they are connected. | ||
* | ||
* Signal connections are unique. If a connection already exists for | ||
* the given `callback` and `thisArg`, this function returns `false`. | ||
* | ||
* A newly connected callback will not be invoked until the next time | ||
* the signal is emitted, even if it is connected while the signal is | ||
* being emitted. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* // connect a method | ||
* someObject.valueChanged.connect(myObject.onValueChanged, myObject); | ||
* | ||
* // connect a plain function | ||
* someObject.valueChanged.connect(myCallback); | ||
* ``` | ||
*/ | ||
connect(callback: (args: T) => void, thisArg?: any): boolean; | ||
/** | ||
* Disconnect a callback from the signal. | ||
* | ||
* @param callback - The callback connected to the signal. | ||
* | ||
* @param thisArg - The `this` context for the callback. | ||
* | ||
* @returns `true` if the connection is broken, `false` otherwise. | ||
* | ||
* #### Notes | ||
* A disconnected callback will no longer be invoked, even if it | ||
* is disconnected while the signal is being emitted. | ||
* | ||
* If no connection exists for the given `callback` and `thisArg`, | ||
* this function returns `false`. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* // disconnect a method | ||
* someObject.valueChanged.disconnect(myObject.onValueChanged, myObject); | ||
* | ||
* // disconnect a plain function | ||
* someObject.valueChanged.disconnect(myCallback); | ||
* ``` | ||
*/ | ||
disconnect(callback: (args: T) => void, thisArg?: any): boolean; | ||
/** | ||
* Emit the signal and invoke the connected callbacks. | ||
* | ||
* @param args - The args object to pass to the callbacks. | ||
* | ||
* #### Notes | ||
* If a connected callback throws an exception, dispatching of the | ||
* signal will terminate immediately and the exception will be | ||
* propagated to the call site of this function. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* someObject.valueChanged.emit(42); | ||
* ``` | ||
*/ | ||
emit(args: T): void; | ||
} | ||
/** | ||
* A decorator which defines a signal for an object. | ||
* | ||
* @param proto - The object prototype on which to define the signal. | ||
* | ||
* @param name - The name of the signal to define. | ||
* | ||
* #### Notes | ||
* When defining a signal from plain JS (where decorators may not be | ||
* supported), this function can be invoked directly with the class | ||
* prototype and signal name. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* class SomeClass { | ||
* | ||
* @signal | ||
* valueChanged: ISignal<number>; | ||
* | ||
* } | ||
* | ||
* // ES5 alternative signal definition | ||
* signal(SomeClass.prototype, 'valueChanged'); | ||
* ``` | ||
*/ | ||
export function signal(proto: any, name: string): void; | ||
/** | ||
* Get the object which is emitting the current signal. | ||
* | ||
* @returns The object emitting the current signal, or `null` if a | ||
* signal is not currently being emitted. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* someObject.valueChanged.connect(myCallback); | ||
* | ||
* someObject.valueChanged.emit(42); | ||
* | ||
* function myCallback(value: number): void { | ||
* console.log(emitter() === someObject); // true | ||
* } | ||
* ``` | ||
*/ | ||
export function emitter(): any; | ||
/** | ||
* Remove all connections where the given object is the emitter. | ||
* | ||
* @param obj - The emitter object of interest. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* disconnectEmitter(someObject); | ||
* ``` | ||
*/ | ||
export function disconnectEmitter(obj: any): void; | ||
/** | ||
* Remove all connections where the given object is the receiver. | ||
* | ||
* @param obj - The receiver object of interest. | ||
* | ||
* #### Notes | ||
* If a `thisArg` is provided when connecting a signal, that object | ||
* is considered the receiver. Otherwise, the `callback` is used as | ||
* the receiver. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* // disconnect a regular object receiver | ||
* disconnectReceiver(myObject); | ||
* | ||
* // disconnect a plain callback receiver | ||
* disconnectReceiver(myCallback); | ||
* ``` | ||
*/ | ||
export function disconnectReceiver(obj: any): void; | ||
/** | ||
* Clear all signal data associated with the given object. | ||
* | ||
* @param obj - The object for which the signal data should be cleared. | ||
* | ||
* #### Notes | ||
* This removes all signal connections where the object is used as | ||
* either the emitter or the receiver. | ||
* | ||
* #### Example | ||
* ```typescript | ||
* clearSignalData(someObject); | ||
* ``` | ||
*/ | ||
export function clearSignalData(obj: any): void; | ||
import main = require('phosphor-signaling/index'); | ||
export = main; | ||
} | ||
{ | ||
"name": "phosphor-signaling", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"description": "A module for type-safe inter-object communication.", | ||
@@ -11,3 +11,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"dts-bundle": "^0.3.0", | ||
"dts-generator": "^1.5.0", | ||
"expect.js": "^0.3.1", | ||
@@ -14,0 +14,0 @@ "mocha": "^2.2.5", |
@@ -1,4 +0,7 @@ | ||
require('dts-bundle').bundle({ | ||
require('dts-generator').generate({ | ||
name: 'phosphor-signaling', | ||
main: 'lib/index.d.ts', | ||
main: 'phosphor-signaling/index', | ||
baseDir: 'lib', | ||
files: ['index.d.ts'], | ||
out: 'lib/phosphor-signaling.d.ts', | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2336
94337