Example #1
0
 return (c: f.ICursor<TState>) =>
     b.createDerivedComponent<TData>(
         b.createComponent<TData>({
             init(ctx: IDataComponentContext<TState, TData>) {
                 ctx.cursor = c;
                 ctx.state = f.getState(ctx.cursor);
             },
             render(ctx: IDataComponentContext<TState, TData>) {
                 ctx.state = f.getState(ctx.cursor);
             }
         }),
         component);
Example #2
0
 return (c: f.ICursor<TState>) => (children?: b.IBobrilChildren) => b.createDerivedComponent(
     b.createComponent({
         init(ctx: IContext<TState>) {
             ctx.cursor = c;
             ctx.state = f.getState(ctx.cursor);
         },
         shouldChange(ctx: IContext<TState>, me: b.IBobrilNode, oldMe: b.IBobrilCacheNode): boolean {
             let previousState = ctx.state;
             ctx.state = f.getState(ctx.cursor);
             return ctx.forceShouldChange || ctx.state !== previousState;
         }
     }),
     component)(null, children);
Example #3
0
 return (c: f.ICursor<TState>) =>
     b.createDerivedComponent<TData>(
         b.createComponent<TData>({
             init(ctx: IRouteComponentContext<TState, TData>) {
                 ctx.cursor = c;
                 ctx.state = f.getState(ctx.cursor);
                 ctx.lastData = ctx.data;
             },
             shouldChange(ctx: IRouteComponentContext<TState, TData>, me: b.IBobrilNode, oldMe: b.IBobrilCacheNode): boolean {
                 let previousState = ctx.state;
                 let previousData = ctx.lastData;
                 ctx.state = f.getState(ctx.cursor);
                 ctx.lastData = ctx.data;
                 return ctx.forceShouldChange || !(ctx.data === previousData && ctx.state === previousState);
             }
         }),
         component);