Skip to content

Instantly share code, notes, and snippets.

@ArnoldATProJanitorDevs
Created March 16, 2022 18:29
TS
class LayoutFactory {
getLayout(device: string): IPadLayout | IPhoneLayout {
if (device === 'IPad') {
return new IPadLayout()
} else {
return new IPhoneLayout()
}
}
}
const factory = new LayoutFactory()
const layout = factory.getLayout(device)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment