question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

introduce a `Point` model

See original GitHub issue

Do you want to request a feature or report a bug?

Improvement.

What’s the current behavior?

Right now ranges have properties that represent their two points:

anchorKey
anchorOffset
focusKey
focusOffset

This is alright, but this idea of a “point” is only inferred. There are already places in the codebase that refer to “points” informally, like in the findPoint utility. And we’ve thought about adding even more of them.

What’s the new behavior?

We’d introduce a new model called a Point:

Point {
  key
  offset
}

And ranges would just have two points, range.anchor and range.focus.

This would standardize the data structure, making it easier to use in some cases since we can provide the utility functions on the Point model directly, and make it more of a known entity for userland code to build with.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
zhujinxuancommented, Jun 19, 2018

@ianstormtaylor I will use anchorPoint and focusPoint as the first step. If they are working, then I will try to rename them and move range.focus to value in the same PR.

1reaction
ianstormtaylorcommented, Jun 19, 2018

@zhujinxuan ah good point. I think I’d like to deprecate the .focus()/.blur() methods (on Range, not on Change) and rename them to something like .setIsFocused(boolean) instead. Or even just remove them in favor of using .set('isFocused', true) from Immutable.js honestly.

(This follows with a separate idea I have that ranges themselves shouldn’t even be where the “focused” state lives, since they are lower level than that, but that’s a discussion for another time.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Point Process Model — part 1
A hands-on introduction to point process models with R ... We can model the intensity of the inhomogenous point process as a function...
Read more >
How to Introduce The Decision Model Successfully
All paths to organizational decision modeling encounter a common question: How do you introduce The Decision Model into an organization?
Read more >
Introduction to models - University of Cape Town
Introduction to models. The major artifacts of software analysis and design are models, a model being a representation of one or more aspects...
Read more >
Modelling & Simulation - Introduction - Tutorialspoint
Step 6 − Create a document of the model for future use, which includes objectives, assumptions, input variables and performance in detail. Step...
Read more >
Introduction to Modeling
Roughly defined, mathematical modeling is the process of constructing math- ... The starting point is the bubble in the upper left-hand, real-world.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found