This file contains 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 { fromEvent, partition, pipe } from "rxjs"; | |
import { shareReplay, takeUntil, repeatWhen } from "rxjs/operators"; | |
// 🛑 unsubscribes when the browser tab is not active | |
// ✅ resubscribe when it is becomes active again | |
export function whilePageIsVisible() { | |
const visibilityChange$ = fromEvent(document, "visibilitychange").pipe( | |
shareReplay({ refCount: true, bufferSize: 1 }) | |
); |
This file contains 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Socket.io Client</title> | |
<base href="/"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script src="//cdn.jsdelivr.net/socket.io-client/1.3.2/socket.io.js" /> | |
<script> |
This file contains 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 { SystemNotificationDirective } from 'ng2-notifications'; | |
@Component({ | |
... | |
directives: [SystemNotificationDirective] | |
}) |
This file contains 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
angular.module('Aether').directive('onReadFile', function($parse, Constants) { | |
return { | |
restrict : 'A', | |
scope : false, | |
link : function(scope, element, attrs) { | |
var fn = $parse(attrs.onReadFile); | |
element.on('change', function(onChangeEvent) { | |
var file = (onChangeEvent.srcElement || onChangeEvent.target).files[0]; | |
var reader = new FileReader(); | |
reader.onload = function(onLoadEvent) { |
This file contains 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": "sample-app", | |
"version": "0.0.1", | |
"description": "App Description", | |
"main": "js/app.js", | |
"dependencies": { | |
"underscore": "^1.7.0" | |
}, | |
"devDependencies": { | |
"browserify": "~6.2.0", |
This file contains 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
$routeProvider | |
.when('/page1', { | |
templateUrl: 'page1/page1.html', | |
controller: 'page1Ctrl', | |
css: { | |
href: 'page1/page1.css', | |
bustCache: true | |
} | |
}); |
This file contains 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
$routeProvider | |
.when('/page1', { | |
templateUrl: 'page1/page1.html', | |
controller: 'page1Ctrl', | |
css: { | |
href: 'page1/page1.css', | |
preload: true | |
} | |
}); |
This file contains 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
$routeProvider | |
.when('/page1', { | |
templateUrl: 'page1/page1.html', | |
controller: 'page1Ctrl', | |
css: { | |
href: 'page1/page1.css', | |
persist: true | |
} | |
}); |
This file contains 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
$routeProvider | |
.when('/tickets', { | |
templateUrl: 'tickets/tickets.html', | |
controller: 'ticketsCtrl', | |
css: [ | |
{ | |
href: 'tickets/tickets.mobile.css', | |
media: '(max-width: 480px)' | |
}, { | |
href: 'tickets/tickets.tablet.css', |
This file contains 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
myApp.directive('itinerary', function () { | |
return { | |
restrict: 'E', | |
templateUrl: 'itinerary/itinerary.html', | |
css: 'itinerary/itinerary.css' | |
} | |
}); |
NewerOlder