mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
@@ -0,0 +1,29 @@
|
||||
/// <reference path="scriptjs.d.ts" />
|
||||
|
||||
import * as $script from 'scriptjs';
|
||||
|
||||
const callback = (): void => console.log('done');
|
||||
|
||||
function main(): void {
|
||||
$script('foo.js', callback);
|
||||
$script(['foo.js', 'bar.js'], callback);
|
||||
|
||||
$script('foo.js', 'foo', callback);
|
||||
$script(['foo.js', 'bar.js'], 'bundle', callback);
|
||||
|
||||
$script('foo', callback);
|
||||
$script('bundle', callback);
|
||||
|
||||
$script.ready('foo', callback);
|
||||
$script.ready('bundle', callback);
|
||||
|
||||
$script.ready(['foo', 'bar', 'thunk'], callback, (missing: string[]): void => console.log('missing deps:', missing));
|
||||
|
||||
$script.path('/js/modules/');
|
||||
|
||||
$script.get('http://example.com/base.js', callback);
|
||||
|
||||
$script.urlArgs('key=value&foo=bar');
|
||||
|
||||
$script.order(['foo.js', 'bar.js'], 'bundle', callback);
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for scriptjs
|
||||
// Project: https://github.com/ded/script.js
|
||||
// Definitions by: Steve Lam <https://github.com/ssttevee>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface $script {
|
||||
(paths:string | string[], idOrDone:string | (() => void), optDone?:() => void): $script;
|
||||
get(path:string, fn:() => void): void;
|
||||
order(scripts:string[], id:string, done:() => void): void;
|
||||
path(p:string): void;
|
||||
urlArgs(str:string): void;
|
||||
ready(deps:string | string[], ready:() => void, req?:(missing:string[]) => void): $script;
|
||||
}
|
||||
|
||||
declare module 'scriptjs'{
|
||||
var $script: $script;
|
||||
export = $script;
|
||||
}
|
||||
Reference in New Issue
Block a user