@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
13 lines (12 loc) • 436 B
JavaScript
import { fireNonCancelableEvent } from '../internal/events';
export function onChangeEffect(editor, onChange) {
if (!editor) {
return;
}
if (!onChange) {
editor.removeAllListeners('change');
}
var callback = function () { return fireNonCancelableEvent(onChange, { value: editor.getValue() }); };
editor.on('change', callback);
return function () { return editor.off('change', callback); };
}