Skip to content

Instantly share code, notes, and snippets.

View vakrilov's full-sized avatar
💡

Alexander Vakrilov vakrilov

💡
View GitHub Profile
@vakrilov
vakrilov / ns-replace-bootstrap.ts
Created August 3, 2018 09:50
ns-bootstrap-transformer
import { dirname, relative } from 'path';
import * as ts from 'typescript';
import {
StandardTransform,
TransformOperation,
collectDeepNodes,
insertStarImport,
ReplaceNodeOperation,
makeTransform,
} from "@ngtools/webpack/src/transformers"
@vakrilov
vakrilov / view-state-utils.ts
Last active August 22, 2018 15:14
view-state-utils
const viewStateKey = "__vs";
export function attachViewState<T>(attachTo: string, defaultValueFactory?: () => T) {
return (target: any, key: string) => {
const assureViewState = (obj) => {
if (typeof obj[attachTo][viewStateKey] === "undefined") {
// console.log("> creating default view sate");
obj[attachTo][viewStateKey] = defaultValueFactory();
}
}
@vakrilov
vakrilov / livesync-navigation.ts
Last active June 5, 2019 07:23
Angular HMR RC
import { NgZone } from "@angular/core";
import { Router } from "@angular/router";
import { onBeforeLivesync, onAfterLivesync } from "nativescript-angular/platform-common";
import { RouterExtensions } from "nativescript-angular/router";
let cachedUrl: string;
onBeforeLivesync.subscribe(moduleRef => {
console.log("#### onBeforeLivesync");
if (moduleRef) {
const router = <Router>moduleRef.injector.get(Router);
@vakrilov
vakrilov / androidx-flowchart.jpg
Last active April 24, 2019 11:06
AndroidX Plugin Migration Guide
androidx-flowchart.jpg