DefinitelyTyped/browser-sync/browser-sync-tests.ts
Phips Peter e6ef60d24a Adding browser-sync definitions
Browser Sync is also really helpful if you want to setup a TypeScript
only development environment.
2015-01-28 14:36:15 -08:00

65 lines
1.2 KiB
TypeScript

/// <reference path="./browser-sync.d.ts"/>
import browserSync = require("browser-sync");
browserSync({
server: {
baseDir: "./"
}
});
browserSync({
proxy: "yourlocal.dev"
});
var config = {
server: {
baseDir: "./"
}
};
// config only
browserSync(config);
// config + callback
browserSync(config, function (err, bs) {
if (!err) {
console.log("BrowserSync is ready!");
}
});
// browser reload
browserSync.reload();
// single file
browserSync.reload( "styles.css" );
// multiple files
browserSync.reload( ["styles.css", "ie.css"] );
// streams support
browserSync.reload( { stream: true } );
browserSync.notify("Compiling, please wait!");
browserSync.notify("HTML <span color='green'>is supported</span> too!");
// Since 1.3.0, specify a timeout
browserSync.notify("This message will only last a second", 1000);
browserSync(config, function (err, bs) {
browserSync.exit();
});
console.log(browserSync.active); // false
browserSync(config, function (err, bs) {
console.log(browserSync.active); // true
});
var evt = browserSync.emitter;
evt.on("init", function () {
console.log("BrowserSync is running!");
});
browserSync(config);