Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

jkh jiangkunhe

🎯
Focusing
  • Beijing
View GitHub Profile
@jiangkunhe
jiangkunhe / v1.js
Created Apr 10, 2019
vue observe demo
View v1.js
const data = {}
let a = 1
let dep = []
let Target = null
Object.defineProperty(data, 'a', {
set: function(val) {
a = val
dep.forEach(fn => fn())
@jiangkunhe
jiangkunhe / push.js
Created Mar 10, 2020
a http2 push demo
View push.js
const http2 = require('http2')
const fs = require('fs')
const privatekey = fs.readFileSync('./certificate/private.pem', 'utf8')
const certificate = fs.readFileSync('./certificate/csr.crt', 'utf8')
const server = http2.createSecureServer({
key: privatekey,
cert: certificate
}, function (req, res) {
res.stream.pushStream({ ':path': '/b.js' }, (err, pushStream, headers) => {
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style type="text/css">
.button {
background: red;
height: 300px;
You can’t perform that action at this time.