Skip to content

Instantly share code, notes, and snippets.

@lighth7015
Last active April 16, 2020 18:50
Show Gist options
  • Save lighth7015/4b76dde16854be3f7e96036975130926 to your computer and use it in GitHub Desktop.
Save lighth7015/4b76dde16854be3f7e96036975130926 to your computer and use it in GitHub Desktop.
import { IModel } from "~/store/Model";
export default
class Application implements IModel {
public modelKey: string = "application";
}
import { h } from 'preact';
import ApplModel from '~/models/Application';
import { Model, IModel } from '~/store/Model';
export default
class Component extends React.Component {
constructor(
private model: Model<ApplModel> = new Model<ApplModel>(this)
) {
// Don't need to do anything here.
}
render() {
return <p>Testing.</p>;
}
};
import { createContext } from "preact";
const AppContext = createContext();
export default AppContext;
import * as React from 'preact';
export interface IModel {
public modelKey: string;
}
export default
class Model<T extends IModel> {
private typeInst: T = new T() => T;
private instance: React.Component;
constructor(
private instance: React.Component
) { }
find(): T {
// Find all models
}
where(memberName: string, memberValue: any ): any {
// Filter.
return this;
}
getInstance(): self {
return this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment