Skip to content

Instantly share code, notes, and snippets.

@wavded
Created January 25, 2012 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wavded/1677893 to your computer and use it in GitHub Desktop.
Save wavded/1677893 to your computer and use it in GitHub Desktop.
block-lambda would be nice
var OrderManager = {
getRecordById: function (id) {
function gridCheck (TypeOrder) {
if (TypeOrder != null) {
var record = TypeOrder.getGrid().store.getById(id)
if (record) {
return { // would like the parent function to exit here (but ain't gonna happen)
record: record,
grid: TypeOrder.getGrid()
}
}
}
}
gridCheck(UnassignedOrder)
gridCheck(SavedOrder)
}
}
// Would be nice to say:
let OrderManager = {
getRecordById: function (id) {
let gridCheck = { |TypeOrder|
if (TypeOrder != null) {
let record = TypeOrder.getGrid().store.getById(id)
if (record) {
return { // return worked!
record: record,
grid: unassigned.getGrid()
}
}
}
}
gridCheck(UnassignedOrder)
gridCheck(SavedOrder)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment