本文整理匯總了TypeScript中phosphor/lib/core/signaling.defineSignal函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript defineSignal函數的具體用法?TypeScript defineSignal怎麽用?TypeScript defineSignal使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了defineSignal函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: onAfterAttach
*/
protected onAfterAttach(msg: Message): void {
this.selectNode.addEventListener('change', this);
}
/**
* Handle `before-detach` messages for the widget.
*/
protected onBeforeDetach(msg: Message): void {
this.selectNode.removeEventListener('change', this);
}
}
// Define the signals for the `CSVToolbar` class.
defineSignal(CSVToolbar.prototype, 'delimiterChanged');
/**
* A namespace for `CSVToolbar` statics.
*/
export
namespace CSVToolbar {
/**
* The instantiation options for a CSV toolbar.
*/
export
interface IOptions {
/**
* The initially selected delimiter.
*/
示例2: defineSignal
_collapsed: boolean;
_content: Panel;
_widget: Widget;
_header: Widget;
}
export
namespace Collapse {
export
interface IOptions extends Widget.IOptions {
widget: Widget;
}
}
// Define the signals for the `Widget` class.
defineSignal(Collapse.prototype, 'collapseChanged');
/**
* The class name added to Accordion instances.
*/
const ACCORDION_CLASS = 'p-Accordion';
/**
* The class name added to an Accordion child.
*/
const ACCORDION_CHILD_CLASS = 'p-Accordion-child';
const ACCORDION_CHILD_ACTIVE_CLASS = 'p-Accordion-child-active';
/**
示例3: defineSignal
} from 'phosphor/lib/core/signaling';
import {
ActivityMonitor
} from '../../../lib/common/activitymonitor';
class TestObject {
one: ISignal<TestObject, number>;
two: ISignal<TestObject, string[]>;
}
defineSignal(TestObject.prototype, 'one');
defineSignal(TestObject.prototype, 'two');
describe('common/activitymonitor', () => {
describe('ActivityMonitor()', () => {
let testObj: TestObject;
let signal: ISignal<TestObject, number>;
beforeEach(() => {
testObj = new TestObject();
signal = testObj.one;
});
示例4: onChildAdded
*/
protected onChildAdded(msg: ChildMessage): void {
msg.child.addClass(CHILD_CLASS);
}
/**
* A message handler invoked on a `'child-removed'` message.
*/
protected onChildRemoved(msg: ChildMessage): void {
msg.child.removeClass(CHILD_CLASS);
this.widgetRemoved.emit(msg.child);
}
}
// Define the signals for the `EventedPanel` class.
defineSignal(EventedPanel.prototype, 'widgetRemoved');
/**
* A widget which combines a `TabBar` and a `EventedPanel`.
*
* #### Notes
* This is a simple panel which handles the common case of a tab bar
* placed next to a content area. The selected tab controls the widget
* which is shown in the content area.
*
* For use cases which require more control than is provided by this
* panel, the `TabBar` widget may be used independently.
*
* TODO: Support setting the direction??
示例5: defineSignal
// A completion request signal should only be emitted if the current
// character or a preceding character is not whitespace.
//
// Otherwise, the default tab action of creating a tab character should be
// allowed to propagate.
if (!currentLine.substring(0, ch).match(/\S/)) {
return;
}
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
const chHeight = editor.defaultTextHeight();
const chWidth = editor.defaultCharWidth();
const coords = editor.charCoords({ line, ch }, 'page') as ICoords;
const position = editor.getDoc().indexFromPos({ line, ch });
let data = {
line, ch, chHeight, chWidth, coords, position, currentValue
};
this.completionRequested.emit(data as ICompletionRequest);
}
}
// Define the signals for the `CompletableCodeMirrorCellEditorWidget` class.
defineSignal(CodeMirrorCellEditorWidget.prototype, 'textChanged');
defineSignal(CodeMirrorCellEditorWidget.prototype, 'completionRequested');
示例6: defineSignal
let maximum = DISPLAY_LIMIT;
if (available > maximum) {
// Mutate the array instead of slicing in order to conserve memory.
output.splice(maximum);
this.maxExceeded.emit({ available, maximum });
}
return output;
}
private _content: string;
private _delimiter: string;
}
// Define the signals for the `CSVModel` class.
defineSignal(CSVModel.prototype, 'maxExceeded');
/**
* A namespace for `CSVModel` statics.
*/
export
namespace CSVModel {
/**
* The value emitted when there are more data rows than what can be displayed.
*/
export
interface IOverflow {
/**
* The actual number of rows in the data.
*/
示例7: setValue
if (this.presenter) {
this.presenter.dispose();
this.presenter = null
}
}
setValue(value: string) {
super.setValue(value);
this.editor.getDoc().clearHistory();
}
/**
* Handle keydown events from the editor.
*/
protected onEditorKeydown(editor: CodeMirror.Editor, event: KeyboardEvent): void {
if (event.shiftKey) {
return;
}
if (event.keyCode === UP_ARROW) {
this.presenter.onPositionUp(this);
} else if (event.keyCode === DOWN_ARROW) {
this.presenter.onPositionDown(this);
}
}
}
// Define the signals for the `CodeMirrorCellEditorWidget` class.
defineSignal(CodeMirrorCellEditorWidget.prototype, 'edgeRequested');
示例8: _norm
*/
private _norm(i: number): number {
return i < 0 ? Math.floor(i) + this.internal.length : Math.floor(i);
}
/**
* Check whether a normalized index is in range.
*/
private _check(i: number): boolean {
return i >= 0 && i < this.internal.length;
}
/**
* Normalize and clamp an index to the list bounds.
*/
private _clamp(i: number): number {
return Math.max(0, Math.min(this._norm(i), this.internal.length));
}
/**
* Normalize and limit a count to the length of the list.
*/
private _limit(c: number): number {
return Math.max(0, Math.min(Math.floor(c), this.internal.length));
}
}
// Define the signals for the `ObservableList` class.
defineSignal(ObservableList.prototype, 'changed');