Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
30 Days Of Javascript | 34,376 | 11 hours ago | 1 | January 25, 2022 | 225 | JavaScript | ||||
30 days of JavaScript programming challenge is a step-by-step guide to learn JavaScript programming language in 30 days. This challenge may take more than 100 days, please just follow your own pace. | ||||||||||
Electrode | 2,078 | 30 | 140 | 15 hours ago | 75 | September 25, 2020 | 13 | other | HTML | |
Web applications with node.js and React | ||||||||||
Next Boilerplate | 1,438 | 4 months ago | 27 | mit | TypeScript | |||||
A well-structured production ready Next.js boilerplate with Typescript, Redux, Jest, Enzyme, Express.js, Sass, Css, EnvConfig, Fetch, Reverse Proxy, Bundle Analyzer and Built-in Project CLI. https://pankod.github.io/next-boilerplate/ | ||||||||||
Redux Cli | 894 | 21 | 2 | 5 years ago | 31 | January 11, 2017 | 26 | JavaScript | ||
An opinionated CLI for building redux/react apps quicker | ||||||||||
Twitter Clone | 449 | 4 months ago | 26 | mit | JavaScript | |||||
Autarky | 304 | 7 days ago | 20 | January 03, 2021 | 29 | mit | TypeScript | |||
Liberating disk space from 📁 node_modules | Built with React | ||||||||||
Takeoff | 270 | 4 years ago | 3 | mit | TypeScript | |||||
A rapid development environment using docker for convenience. | ||||||||||
Rwa Trivia | 246 | 2 years ago | 6 | TypeScript | ||||||
Trivia App - Real World Angular series | ||||||||||
Angular Ngrx Socket Frontend | 166 | 4 years ago | 2 | mit | TypeScript | |||||
Angular Ngrx Socket.IO Example | ||||||||||
Angular Ngrx Chuck Norris | 145 | a year ago | 18 | TypeScript | ||||||
Chuck Norris Joke Generator w/ NgRx Store |
一款开源的的 Node.js Bigpipe 框架。支持 koa 和 express。
$ npm install bigview --save
使用 bigview-cli 脚手架创建模块;
$ npm install -g bigview-cli
进入项目 app 目录;我们创建第一个模块 bphello
;我们新建一个文件夹 bphello
;然后我们进入该目录输入:
$ bpm a b c
这个时候程序会自动创建三个 pagelet 模块;
generate ~/a/MyPagelet.js
generate ~/a/index.html
generate ~/a/index.js
generate ~/a/req.js
generate ~/b/MyPagelet.js
generate ~/b/index.html
generate ~/b/index.js
generate ~/b/req.js
generate ~/c/MyPagelet.js
generate ~/c/index.html
generate ~/c/index.js
generate ~/c/req.js
接下来我们需要创建具体的 bigview 将三个 pagelet 串起来; 我们在 bp-hello-world
目录下创建 index.js
;
const BigView = require('bigview')
const a = require('./a')
const b = require('./b')
const c = require('./c')
module.exports = async (ctx, next) => {
const bigview = new BigView(ctx, {
layout: a,
})
// bigpipe.mode = 'render'
bigview.timeout = 5000
bigview.add(b)
bigview.add(c)
await bigview.start()
}
目前 bigview 不提供模板渲染能力,如果需要支持模板渲染,你们需要在 context 中引入 render
方法 比如引入了 nunjucks 我们需要在 app/extend/context.js
加上 render
:
const nunjucks = require('nunjucks')
...
render (tpl, data, cb) {
const env = nunjucks.configure({
// your template config
})
if (/\.nj$/.test(tpl) || /\.html$/.test(tpl)) {
env.render(tpl, data, (err, html) => {
err && debug(err)
cb(err, html)
})
} else {
env.renderString(tpl, data, (err, html) => {
err && debug(err)
cb(err, html)
})
}
}
这个时候 bp-hello-world 创建的差不多了。这个时候我们需要在 app/router.js
中定义路由:
const bpHelloWorld = require('./bp-hello-world')
...
app.router.get('/hello', bpHelloWorld)
这个时候启动程序,然后输入路由后就可以看到我们刚刚完成的一个 bigpipe 页面;
目前支持五种渲染模式:
关于 bigview 支持的 mode 可以进入 bigview-mode 查看具体文档。
bigview的生命周期
before
.then(this.beforeRenderLayout.bind(this))
.then(this.renderLayout.bind(this))
.then(this.renderMain.bind(this))
.then(this.afterRenderLayout.bind(this))
.then(this.beforeRenderPagelets.bind(this))
.then(this.renderPagelets.bind(this))
.then(this.afterRenderPagelets.bind(this))
end
精简一下,核心5个步骤。
bigview的生命周期精简
biglet的生命周期
// index.js
const BigViewRedux = require('bigview-redux')
const bigView = new BigView(ctx)
bigView.install(BigViewRedux)
// pagelet
'use strict'
const Biglet = require('biglet')
const actions = require('./lib/actions')
const reducer = require('./lib/reducer')
class TodoListPagelet extends Biglet {
constructor (owner) {
super(owner)
this.reducer = reducer
this.root = __dirname
this.tpl = './index.nj'
this.name = 'todolist'
this.domid = 'todolist'
}
changeTodoList () {
const state = this.owner.getState() // 获取store中的state
this.data = {
todoList: state[this.name]
}
}
async fetch () {
this.sub(this.changeTodoList) // store改变后的订阅者函数
const text = '测试数据'
this.owner.dispatch(actions.addTodo(text)) // 触发action
}
}