Hmm, some unforeseen challenges.

I have this code:

---cut here---
// Promise wrapper for simple XMLHttpRequest GET
export function getData(url) {
    return new Promise(function(resolve, reject) {
        var req = new XMLHttpRequest()
        req.open('GET', url)
        req.onload = function () {
            if (req.status == 200) resolve(JSON.parse(req.response))
            else reject({code: req.status, message: req.statusText})
        }
        req.send()
    })
}
---cut here---

I want to extract it to a node called 'getData'.  But I don't have a
pattern for `export function....`.  So it gets put in a node called
`onload` because there is a pattern that matches that.

Well, ok, so let me just use the manual 'first line of selection is
headline' mode, where I enter `getData` in the body text on its own
line ahead of the block and then select from that down to `}`.

Nope, `onload` still takes priority.  Ok, I'll add a pattern to force
use of the first line, e.g. a pattern starting with '|', so instead of
entering `getData` in the body text I enter `|getData`. Ok, right
headline, but leaves `|getData` at the top of the body text.

Seems like the simplest thing might be hard coding a mechanism like
the leading `|` to force first line is headline mode.  Of course
having a pattern for `export function...` would work too, but there
will always be missing patterns.

Thoughts?

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to