Giter VIP home page Giter VIP logo

Comments (7)

yilunzhang avatar yilunzhang commented on June 3, 2024

This is autogenerated code by protobuf: https://developers.google.com/protocol-buffers/docs/reference/javascript-generated

from nkn-client-js.

losnappas avatar losnappas commented on June 3, 2024

should replace it anyways, if you ask me. Or maybe they have a method of generating it without function eval

from nkn-client-js.

yilunzhang avatar yilunzhang commented on June 3, 2024

What problem are you getting into exactly? Typically modifying generated pb code is not a good way, we can see whether we can overcome it without having to manually modify the generated file every time we modify pb definition.

from nkn-client-js.

losnappas avatar losnappas commented on June 3, 2024

Run this lib through browserify and you'll get a CSP error on Firefox, because of those 2 lines.

In fact, the files in /dist have this problem too.

from nkn-client-js.

yilunzhang avatar yilunzhang commented on June 3, 2024

#44 should solve this issue, @losnappas could you please confirm?

from nkn-client-js.

losnappas avatar losnappas commented on June 3, 2024

Works, and I have an improvement.

instead doing the transformation in Gruntfile.js, move it into package.json, so that when I do require('nkn-client'), my browserify will know what to do, too. (So I won't need to explicitly use the dist files, which makes life a bit easier).

like this (package.json):

"browserify": {
  	"transform": [
  		["browserify-replace", 
			{
				"replace": [{
					"from": "var global = Function\\('return this'\\)\\(\\);",
					"to": "var global = (function(){ return this  }).call(null);"
				}]
			}
		]
  	]
  },

And you'll probably want to bump the version in package.json, too, if you forgot.

Made u a PR yilunzhang#1 to save your time.

from nkn-client-js.

yilunzhang avatar yilunzhang commented on June 3, 2024

Thanks! Merged your PR.

from nkn-client-js.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.