Skip to content

Conversation

@davidjbradshaw
Copy link
Owner

Update API

  • Alias onClose -> onBeforeClose
  • Alias onClosed -> onAfterClose
  • Alias offset -> offsetSize

The old names will continue to work with a warning and will be removed in a later major version.

@davidjbradshaw davidjbradshaw requested a review from Copilot July 14, 2025 09:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the public API by renaming the existing onClose, onClosed, and offset options to onBeforeClose, onAfterClose, and offsetSize, respectively, while preserving backward compatibility with deprecation warnings.

  • Rename event callbacks in core defaults, index, wrappers, and examples
  • Introduce updateOptionName to alias old option names and warn users
  • Update tests and example files to use new option names

Reviewed Changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
spec/closeSpec.js Update test to use onAfterClose instead of onClosed
packages/vue/iframe-resizer.vue Rename onCloseonBeforeClose in Vue wrapper
packages/react/index.jsx Rename onCloseonBeforeClose in React wrapper
packages/core/values/defaults.js Update defaults: onBeforeClose & onAfterClose
packages/core/index.js Rename helpers (chkEventcheckEvent, etc.) and add aliasing
packages/common/filter-iframe-attribs.* Update destructuring/tests from onClosedonAfterClose
packages/angular/directive.ts Rename Angular @Output() onCloseonBeforeClose
example/**/* Update example HTML/JS to use onAfterClose
Comments suppressed due to low confidence (2)

packages/angular/directive.ts:54

  • Add a corresponding @Output() onAfterClose = new EventEmitter<iframeResizerElement>() and wire it to the onClosed callback so Angular consumers can still subscribe to the after-close event.
  @Output() onBeforeClose = new EventEmitter<iframeResizerElement>()

packages/core/index.js:1182

  • [nitpick] Consider checking if the user has already provided the newName option before renaming the oldName, to avoid overwriting an explicit newName value when both are supplied.
  function updateOptionName(oldName, newName) {

onClose: () => {
consoleGroup.event('onClose')
onBeforeClose: () => {
consoleGroup.event('Blocked Close Event')
Copy link

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Use a clear event label like 'onBeforeClose' instead of a generic message to align with the renamed callback and improve traceability in logs.

Suggested change
consoleGroup.event('Blocked Close Event')
consoleGroup.event('onBeforeClose')

Copilot uses AI. Check for mistakes.
@davidjbradshaw davidjbradshaw merged commit 6c0d714 into master Jul 15, 2025
7 checks passed
@davidjbradshaw davidjbradshaw deleted the onBeforeAfter branch July 15, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants