jsoverson / hackium-plugin-preserve-native

Repository from Github https://github.comjsoverson/hackium-plugin-preserve-nativeRepository from Github https://github.comjsoverson/hackium-plugin-preserve-native

preserve-native Hackium plugin

A plugin for Hackium that preserves native DOM API methods in the hackium object, e.g.

JSON.stringify = function(){ throw new Error('Nope, no stringify for you'); }

let myObject = { a: 'b' };

let json = JSON.stringify(myObject); // throws error

let json = hackium.JSON.stringify(myObject); // preserved intact.

When would I use this?

Some sites override methods for "security" purposes, others intercept method calls to modify behavior, and others still have outdated, buggy polyfills that you can't rely on. This plugin keeps many native methods around. Submit a PR if you want other methods saved.

Usage

import { Hackium } from 'hackium';
import plugin from 'hackium-plugin-preserve-native';

let hackium = new Hackium({ plugins: [ plugin ] });
...

About


Languages

Language:TypeScript 55.6%Language:JavaScript 25.6%Language:HTML 18.8%