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

example: prototype op crate #3031

Closed
wants to merge 14 commits into from
Prev Previous commit
Next Next commit
Maybe we can use split file namespaces
  • Loading branch information
ry committed Sep 26, 2019
commit e9e0e80e154998c7df9da278498b13e2d3a882fd
20 changes: 10 additions & 10 deletions op_hello/src/hello.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const OP_HELLO: number = Deno.ops.add("hello");

/**
* The typedoc here ideally would be presevered automatically in
* lib.deno_runtime.d.ts
* Potentially by using this new method of defining functions on Deno, the d.ts
* file generated by typescript will be nicer. If not, we will keep maintaining
* lib.deno_runtime.d.ts by hand until we automate a solution.
*/
Deno.hello = () => {
Deno.core.send(OP_HELLO);
};
// https://www.typescriptlang.org/docs/handbook/namespaces.html#splitting-across-files
namespace Deno {
/**
* The typedoc here ideally would be presevered automatically in
* lib.deno_runtime.d.ts
*/
export function hello() {
Deno.core.send(OP_HELLO);
}
}