Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addWidget(el, options) with object param #1038

Merged
merged 1 commit into from
Nov 13, 2019
Merged

addWidget(el, options) with object param #1038

merged 1 commit into from
Nov 13, 2019

Conversation

adumesny
Copy link
Member

@adumesny adumesny commented Nov 13, 2019

Description

fix for #907

  • new addWidget(el, options) to pass object so you don't have to spell 10 params
  • updated TS file, test case, some samples
  • also renamed IGridstackOptions to GridstackOptions (angular/TS style guide avoid cap I for interfaces, the others were correct already).

Checklist

  • Created tests which fail without the change (if possible)
  • All tests passing (yarn test)
  • Extended the README / documentation, if necessary

* new addWidget(el, options) to pass object so you don't have to spell 10 params
* updated TS file, test case, some samples
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 65.711% when pulling 52dfb46 on adumesny:develop into 0fc9b72 on gridstack:develop.

@radiolips radiolips merged commit a902f3c into gridstack:develop Nov 13, 2019
GridStack.prototype.addWidget = function(el, x, y, width, height, autoPosition, minWidth, maxWidth, minHeight, maxHeight, id) {

// instead of passing all the params, the user might pass an object with all fields instead, if so extract them and call us back
if (typeof x === 'object') {
Copy link

Choose a reason for hiding this comment

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

this will fail if we pass null as a value of x, as typeof null === 'object' returns true.

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.

4 participants