Last active
January 30, 2016 02:41
-
-
Save cdl/2499e2534ad4d4c9bc20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Nimble from 'nimble'; | |
export default Nimble.Plugin.extend({ | |
/** | |
* request: Returns a Promise that resolves with a search response, or rejects with an error. | |
* @attr term – The search term given. | |
**/ | |
request(term, function() { | |
// ... return the promise | |
}), | |
deserializeResults(results, function() { | |
// do shit to the results and return | |
// the context you wish to use in the template (Object) | |
}), | |
renderTemplate(results, function() { | |
// return a serialized a template (uses Handlebars or some shit idk) | |
// that's displayed as the "results" on a successful result | |
}), | |
deserializeError(error, function() { | |
// deserialize the resolution of the Error from the request | |
}), | |
renderError(error, function() { | |
// return a template (Handlebars or some shit) that should be | |
// displayed as the "results" on a failing result (this defaults to | |
// `false` by default which shows the default Nimble error) | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Example Plugin", | |
"author": "Colby Ludwig <[email protected]>", | |
"description": "An example plugin for Nimble.", | |
"url": "https://ldwg.me/example", | |
"tags": ["search", "plugin", "example] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment