Skip to content

Commit

Permalink
Remove __timers namespace (denoland#4662)
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Apr 7, 2020
1 parent 481fcfc commit 6272643
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 29 deletions.
45 changes: 16 additions & 29 deletions cli/js/lib.deno.shared_globals.d.ts
Expand Up @@ -15,12 +15,7 @@ declare interface WindowOrWorkerGlobalScope {
// methods
atob: typeof __textEncoding.atob;
btoa: typeof __textEncoding.btoa;
clearInterval: typeof __timers.clearInterval;
clearTimeout: typeof __timers.clearTimeout;
fetch: typeof __fetch.fetch;
setInterval: typeof __timers.setInterval;
queueMicrotask: typeof __timers.queueMicrotask;
setTimeout: typeof __timers.setTimeout;
// properties
console: __console.Console;
Blob: typeof __blob.DenoBlob;
Expand Down Expand Up @@ -228,12 +223,23 @@ declare namespace WebAssembly {

declare const atob: typeof __textEncoding.atob;
declare const btoa: typeof __textEncoding.btoa;
declare const clearInterval: typeof __timers.clearInterval;
declare const clearTimeout: typeof __timers.clearTimeout;
declare const fetch: typeof __fetch.fetch;
declare const setInterval: typeof __timers.setInterval;
declare const setTimeout: typeof __timers.setTimeout;
declare const queueMicrotask: typeof __timers.queueMicrotask;

/** Sets a timer which executes a function once after the timer expires. */
declare function setTimeout(
cb: (...args: unknown[]) => void,
delay?: number,
...args: unknown[]
): number;
/** Repeatedly calls a function , with a fixed time delay between each call. */
declare function setInterval(
cb: (...args: unknown[]) => void,
delay?: number,
...args: unknown[]
): number;
declare function clearTimeout(id?: number): void;
declare function clearInterval(id?: number): void;
declare function queueMicrotask(func: Function): void;

declare const console: __console.Console;
declare const Blob: typeof __blob.DenoBlob;
Expand Down Expand Up @@ -1400,25 +1406,6 @@ declare namespace __textEncoding {
}
}

declare namespace __timers {
export type Args = unknown[];
/** Sets a timer which executes a function once after the timer expires. */
export function setTimeout(
cb: (...args: Args) => void,
delay?: number,
...args: Args
): number;
/** Repeatedly calls a function , with a fixed time delay between each call. */
export function setInterval(
cb: (...args: Args) => void,
delay?: number,
...args: Args
): number;
export function clearTimeout(id?: number): void;
export function clearInterval(id?: number): void;
export function queueMicrotask(func: Function): void;
}

declare namespace __urlSearchParams {
export class URLSearchParams {
constructor(init?: string | string[][] | Record<string, string>);
Expand Down
3 changes: 3 additions & 0 deletions deno_typescript/lib.rs
Expand Up @@ -327,6 +327,9 @@ pub fn trace_serializer() {
pub fn op_fetch_asset<S: ::std::hash::BuildHasher>(
custom_assets: HashMap<String, PathBuf, S>,
) -> impl Fn(&[u8], Option<ZeroCopyBuf>) -> CoreOp {
for (_, path) in custom_assets.iter() {
println!("cargo:rerun-if-changed={}", path.display());
}
move |control: &[u8], zero_copy_buf: Option<ZeroCopyBuf>| -> CoreOp {
assert!(zero_copy_buf.is_none()); // zero_copy_buf unused in this op.
let name = std::str::from_utf8(control).unwrap();
Expand Down

0 comments on commit 6272643

Please sign in to comment.