MCPcopy Create free account
hub / github.com/docker/getting-started / createEventEmitter

Function createEventEmitter

app/src/static/js/react-bootstrap.js:8503–8524  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

8501}
8502
8503function createEventEmitter(value) {
8504 var handlers = [];
8505 return {
8506 on: function on(handler) {
8507 handlers.push(handler);
8508 },
8509 off: function off(handler) {
8510 handlers = handlers.filter(function (h) {
8511 return h !== handler;
8512 });
8513 },
8514 get: function get() {
8515 return value;
8516 },
8517 set: function set(newValue, changedBits) {
8518 value = newValue;
8519 handlers.forEach(function (handler) {
8520 return handler(value, changedBits);
8521 });
8522 }
8523 };
8524}
8525
8526function onlyChild(children) {
8527 return Array.isArray(children) ? children[0] : children;

Callers 1

ProviderFunction · 0.85

Calls 1

handlerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…