This file contains hidden or 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 { NgModule } from '@angular/core'; | |
import { NgxsModule } from '@ngxs/store'; | |
import { NgxsEmitPluginModule } from '@ngxs-labs/emitter'; | |
@NgModule({ | |
imports: [ | |
NgxsModule.forRoot(states), | |
NgxsEmitPluginModule.forRoot() | |
] | |
}) |
This file contains hidden or 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 { State, StateContext } from '@ngxs/store'; | |
import { Receiver } from '@ngxs-labs/emitter'; | |
export interface CounterStateModel { | |
value: number; | |
} | |
@State<CounterStateModel>({ | |
name: 'counter', | |
defaults: { |
This file contains hidden or 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 { Component } from '@angular/core'; | |
import { Select } from '@ngxs/store'; | |
import { Emitter, Emittable } from '@ngxs-labs/emitter'; | |
import { CounterState } from './counter.state'; | |
@Component({ | |
selector: 'app-counter', | |
template: ` | |
<ng-container *ngIf="counter$ | async as counter"> |
This file contains hidden or 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('@angular/core'); |
This file contains hidden or 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
$ d8 dynamic-import.js --print-bytecode |
This file contains hidden or 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
0 E> 0x1227e79a28aa @ 0 : a2 StackCheck | |
0 S> 0x1227e79a28ab @ 1 : 12 00 LdaConstant [0] | |
0x1227e79a28ad @ 3 : 26 f9 Star r2 | |
0x1227e79a28af @ 5 : 27 fe fa Mov <closure>, r1 | |
0x1227e79a28b2 @ 8 : 5e d4 00 fa 02 CallRuntime [DynamicImportCall], r1-r2 | |
0x1227e79a28b7 @ 13 : 26 fb Star r0 | |
25 S> 0x1227e79a28b9 @ 15 : a6 Return |
This file contains hidden or 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
void BytecodeGenerator::VisitImportCallExpression(ImportCallExpression* expr) { | |
RegisterList args = register_allocator()->NewRegisterList(2); | |
VisitForRegisterValue(expr->argument(), args[1]); | |
builder() | |
->MoveRegister(Register::function_closure(), args[0]) | |
.CallRuntime(Runtime::kDynamicImportCall, args); | |
} |
This file contains hidden or 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
RUNTIME_FUNCTION(Runtime_DynamicImportCall) { | |
HandleScope scope(isolate); | |
DCHECK_EQ(2, args.length()); | |
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | |
CONVERT_ARG_HANDLE_CHECKED(Object, specifier, 1); | |
Handle<Script> script(Script::cast(function->shared()->script()), isolate); | |
while (script->has_eval_from_shared()) { | |
script = handle(Script::cast(script->eval_from_shared()->script()), isolate); |
This file contains hidden or 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
const cache: { | |
[key: string]: any; | |
} = {}; | |
function getModuleCode(path: string): Promise<string> { | |
return fetch(path).then((res) => res.text()); | |
} | |
async function import<T = unknown>(path: string): Promise<T> { | |
if (cache.hasOwnProperty(path)) { |
This file contains hidden or 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
this.currentUrlTree = createEmptyUrlTree(); | |
export function createEmptyUrlTree() { | |
return new UrlTree(new UrlSegmentGroup([], {}), {}, null); | |
} |
OlderNewer