Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

removal.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.remove = remove;
  6. exports._removeFromScope = _removeFromScope;
  7. exports._callRemovalHooks = _callRemovalHooks;
  8. exports._remove = _remove;
  9. exports._markRemoved = _markRemoved;
  10. exports._assertUnremoved = _assertUnremoved;
  11. var _removalHooks = require("./lib/removal-hooks");
  12. var _cache = require("../cache");
  13. var _index = require("./index");
  14. function remove() {
  15. var _this$opts;
  16. this._assertUnremoved();
  17. this.resync();
  18. if (!((_this$opts = this.opts) != null && _this$opts.noScope)) {
  19. this._removeFromScope();
  20. }
  21. if (this._callRemovalHooks()) {
  22. this._markRemoved();
  23. return;
  24. }
  25. this.shareCommentsWithSiblings();
  26. this._remove();
  27. this._markRemoved();
  28. }
  29. function _removeFromScope() {
  30. const bindings = this.getBindingIdentifiers();
  31. Object.keys(bindings).forEach(name => this.scope.removeBinding(name));
  32. }
  33. function _callRemovalHooks() {
  34. for (const fn of _removalHooks.hooks) {
  35. if (fn(this, this.parentPath)) return true;
  36. }
  37. }
  38. function _remove() {
  39. if (Array.isArray(this.container)) {
  40. this.container.splice(this.key, 1);
  41. this.updateSiblingKeys(this.key, -1);
  42. } else {
  43. this._replaceWith(null);
  44. }
  45. }
  46. function _markRemoved() {
  47. this._traverseFlags |= _index.SHOULD_SKIP | _index.REMOVED;
  48. if (this.parent) _cache.path.get(this.parent).delete(this.node);
  49. this.node = null;
  50. }
  51. function _assertUnremoved() {
  52. if (this.removed) {
  53. throw this.buildCodeFrameError("NodePath has been removed so is read-only.");
  54. }
  55. }